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
00047 m_label = new QLabel( label, frame );
00048 layout->addWidget( m_label );
00049
00050 m_lineEdit = new KLineEdit( value, frame );
00051 layout->addWidget( m_lineEdit );
00052
00053 m_lineEdit->setFocus();
00054 m_label->setBuddy( m_lineEdit );
00055
00056 layout->addWidget( new QLabel( i18n( "Data format:" ), frame ) );
00057 m_comboBox = new KComboBox( frame );
00058 m_comboBox->addItems( items );
00059 layout->addWidget( m_comboBox );
00060
00061 layout->addStretch();
00062
00063
00064
00065
00066
00067
00068 setMinimumWidth( 350 );
00069
00070 m_clipboardChanged = false;
00071 if ( clipboard )
00072 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
00073 this, SLOT( slotClipboardDataChanged() ) );
00074 }
00075
00076 void KIO::PasteDialog::slotClipboardDataChanged()
00077 {
00078 m_clipboardChanged = true;
00079 }
00080
00081 QString KIO::PasteDialog::lineEditText() const
00082 {
00083 return m_lineEdit->text();
00084 }
00085
00086 int KIO::PasteDialog::comboItem() const
00087 {
00088 return m_comboBox->currentIndex();
00089 }
00090
00091 #include "pastedialog.moc"