pastedialog.cpp
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2005 David Faure <faure@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "pastedialog.h" 00020 00021 #include <klineedit.h> 00022 #include <kmimetype.h> 00023 #include <klocale.h> 00024 00025 #include <tqlayout.h> 00026 #include <tqlabel.h> 00027 #include <tqcombobox.h> 00028 #include <tqapplication.h> 00029 #include <tqclipboard.h> 00030 00031 KIO::PasteDialog::PasteDialog( const TQString &caption, const TQString &label, 00032 const TQString &value, const TQStringList& items, 00033 TQWidget *parent, 00034 bool clipboard ) 00035 : KDialogBase( parent, 0 /*name*/, true, caption, Ok|Cancel, Ok, true ) 00036 { 00037 TQFrame *frame = makeMainWidget(); 00038 TQVBoxLayout *layout = new TQVBoxLayout( frame, 0, spacingHint() ); 00039 00040 m_label = new TQLabel( label, frame ); 00041 layout->addWidget( m_label ); 00042 00043 m_lineEdit = new KLineEdit( value, frame ); 00044 layout->addWidget( m_lineEdit ); 00045 00046 m_lineEdit->setFocus(); 00047 m_label->setBuddy( m_lineEdit ); 00048 00049 layout->addWidget( new TQLabel( i18n( "Data format:" ), frame ) ); 00050 m_comboBox = new TQComboBox( frame ); 00051 m_comboBox->insertStringList( items ); 00052 layout->addWidget( m_comboBox ); 00053 00054 layout->addStretch(); 00055 00056 //connect( m_lineEdit, TQT_SIGNAL( textChanged( const TQString & ) ), 00057 // TQT_SLOT( slotEditTextChanged( const TQString & ) ) ); 00058 //connect( this, TQT_SIGNAL( user1Clicked() ), m_lineEdit, TQT_SLOT( clear() ) ); 00059 00060 //slotEditTextChanged( value ); 00061 setMinimumWidth( 350 ); 00062 00063 m_clipboardChanged = false; 00064 if ( clipboard ) 00065 connect( TQApplication::clipboard(), TQT_SIGNAL( dataChanged() ), 00066 this, TQT_SLOT( slotClipboardDataChanged() ) ); 00067 } 00068 00069 void KIO::PasteDialog::slotClipboardDataChanged() 00070 { 00071 m_clipboardChanged = true; 00072 } 00073 00074 TQString KIO::PasteDialog::lineEditText() const 00075 { 00076 return m_lineEdit->text(); 00077 } 00078 00079 int KIO::PasteDialog::comboItem() const 00080 { 00081 return m_comboBox->currentItem(); 00082 } 00083 00084 #include "pastedialog.moc"