KIO
pastedialog.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "pastedialog.h"
00020
00021 #include <kcombobox.h>
00022 #include <klineedit.h>
00023 #include <klocale.h>
00024
00025 #include <QApplication>
00026 #include <QLabel>
00027 #include <QLayout>
00028 #include <QClipboard>
00029
00030 KIO::PasteDialog::PasteDialog( const QString &caption, const QString &label,
00031 const QString &value, const QStringList& items,
00032 QWidget *parent,
00033 bool clipboard )
00034 : KDialog( parent )
00035 {
00036 setCaption( caption );
00037 setButtons( Ok | Cancel );
00038 setModal( true );
00039 showButtonSeparator( true );
00040 setDefaultButton( Ok );
00041
00042 QFrame *frame = new QFrame;
00043 setMainWidget( frame );
00044
00045 QVBoxLayout *layout = new QVBoxLayout( frame );
00046 layout->setSpacing( spacingHint() );
00047
00048 m_label = new QLabel( label, frame );
00049 layout->addWidget( m_label );
00050
00051 m_lineEdit = new KLineEdit( value, frame );
00052 layout->addWidget( m_lineEdit );
00053
00054 m_lineEdit->setFocus();
00055 m_label->setBuddy( m_lineEdit );
00056
00057 layout->addWidget( new QLabel( i18n( "Data format:" ), frame ) );
00058 m_comboBox = new KComboBox( frame );
00059 m_comboBox->addItems( items );
00060 layout->addWidget( m_comboBox );
00061
00062 layout->addStretch();
00063
00064
00065
00066
00067
00068
00069 setMinimumWidth( 350 );
00070
00071 m_clipboardChanged = false;
00072 if ( clipboard )
00073 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
00074 this, SLOT( slotClipboardDataChanged() ) );
00075 }
00076
00077 void KIO::PasteDialog::slotClipboardDataChanged()
00078 {
00079 m_clipboardChanged = true;
00080 }
00081
00082 QString KIO::PasteDialog::lineEditText() const
00083 {
00084 return m_lineEdit->text();
00085 }
00086
00087 int KIO::PasteDialog::comboItem() const
00088 {
00089 return m_comboBox->currentIndex();
00090 }
00091
00092 #include "pastedialog.moc"