diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /libkdepim/kcmdesignerfields.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdepim/kcmdesignerfields.cpp')
-rw-r--r-- | libkdepim/kcmdesignerfields.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/libkdepim/kcmdesignerfields.cpp b/libkdepim/kcmdesignerfields.cpp index 8e18efc47..79a570ae5 100644 --- a/libkdepim/kcmdesignerfields.cpp +++ b/libkdepim/kcmdesignerfields.cpp @@ -22,17 +22,17 @@ #include <unistd.h> -#include <qimage.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qobjectlist.h> -#include <qpixmap.h> -#include <qpushbutton.h> -#include <qwhatsthis.h> -#include <qgroupbox.h> -#include <qwidgetfactory.h> -#include <qregexp.h> -#include <qtimer.h> +#include <tqimage.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqobjectlist.h> +#include <tqpixmap.h> +#include <tqpushbutton.h> +#include <tqwhatsthis.h> +#include <tqgroupbox.h> +#include <tqwidgetfactory.h> +#include <tqregexp.h> +#include <tqtimer.h> #include <kaboutdata.h> #include <kdebug.h> @@ -56,29 +56,29 @@ using namespace KPIM; class PageItem : public QCheckListItem { public: - PageItem( QListView *parent, const QString &path ) - : QCheckListItem( parent, "", QCheckListItem::CheckBox ), + PageItem( TQListView *parent, const TQString &path ) + : TQCheckListItem( parent, "", TQCheckListItem::CheckBox ), mPath( path ), mIsActive( false ) { mName = path.mid( path.findRev( '/' ) + 1 ); - QWidget *wdg = QWidgetFactory::create( mPath, 0, 0 ); + TQWidget *wdg = TQWidgetFactory::create( mPath, 0, 0 ); if ( wdg ) { setText( 0, wdg->caption() ); - QPixmap pm = QPixmap::grabWidget( wdg ); - QImage img = pm.convertToImage().smoothScale( 300, 300, QImage::ScaleMin ); + TQPixmap pm = TQPixmap::grabWidget( wdg ); + TQImage img = pm.convertToImage().smoothScale( 300, 300, TQImage::ScaleMin ); mPreview = img; - QObjectList *list = wdg->queryList( "QWidget" ); - QObjectListIt it( *list ); + TQObjectList *list = wdg->queryList( "TQWidget" ); + TQObjectListIt it( *list ); - QMap<QString, QString> allowedTypes; - allowedTypes.insert( "QLineEdit", i18n( "Text" ) ); - allowedTypes.insert( "QTextEdit", i18n( "Text" ) ); - allowedTypes.insert( "QSpinBox", i18n( "Numeric Value" ) ); - allowedTypes.insert( "QCheckBox", i18n( "Boolean" ) ); - allowedTypes.insert( "QComboBox", i18n( "Selection" ) ); + TQMap<TQString, TQString> allowedTypes; + allowedTypes.insert( "TQLineEdit", i18n( "Text" ) ); + allowedTypes.insert( "TQTextEdit", i18n( "Text" ) ); + allowedTypes.insert( "TQSpinBox", i18n( "Numeric Value" ) ); + allowedTypes.insert( "TQCheckBox", i18n( "Boolean" ) ); + allowedTypes.insert( "TQComboBox", i18n( "Selection" ) ); allowedTypes.insert( "QDateTimeEdit", i18n( "Date & Time" ) ); allowedTypes.insert( "KLineEdit", i18n( "Text" ) ); allowedTypes.insert( "KDateTimeWidget", i18n( "Date & Time" ) ); @@ -86,12 +86,12 @@ class PageItem : public QCheckListItem while ( it.current() ) { if ( allowedTypes.find( it.current()->className() ) != allowedTypes.end() ) { - QString name = it.current()->name(); + TQString name = it.current()->name(); if ( name.startsWith( "X_" ) ) { - new QListViewItem( this, name, + new TQListViewItem( this, name, allowedTypes[ it.current()->className() ], it.current()->className(), - QWhatsThis::textFor( static_cast<QWidget*>( it.current() ) ) ); + TQWhatsThis::textFor( static_cast<TQWidget*>( it.current() ) ) ); } } @@ -102,10 +102,10 @@ class PageItem : public QCheckListItem } } - QString name() const { return mName; } - QString path() const { return mPath; } + TQString name() const { return mName; } + TQString path() const { return mPath; } - QPixmap preview() + TQPixmap preview() { return mPreview; } @@ -114,22 +114,22 @@ class PageItem : public QCheckListItem bool isActive() const { return mIsActive; } protected: - void paintBranches( QPainter *p, const QColorGroup & cg, int w, int y, int h ) + void paintBranches( TQPainter *p, const TQColorGroup & cg, int w, int y, int h ) { - QListViewItem::paintBranches( p, cg, w, y, h ); + TQListViewItem::paintBranches( p, cg, w, y, h ); } private: - QString mName; - QString mPath; - QPixmap mPreview; + TQString mName; + TQString mPath; + TQPixmap mPreview; bool mIsActive; }; -KCMDesignerFields::KCMDesignerFields( QWidget *parent, const char *name ) +KCMDesignerFields::KCMDesignerFields( TQWidget *parent, const char *name ) : KCModule( parent, name ) { - QTimer::singleShot( 0, this, SLOT( delayedInit() ) ); + TQTimer::singleShot( 0, this, TQT_SLOT( delayedInit() ) ); KAboutData *about = new KAboutData( I18N_NOOP( "KCMDesignerfields" ), I18N_NOOP( "Qt Designer Fields Dialog" ), @@ -147,31 +147,31 @@ void KCMDesignerFields::delayedInit() initGUI(); - connect( mPageView, SIGNAL( selectionChanged( QListViewItem* ) ), - this, SLOT( updatePreview( QListViewItem* ) ) ); - connect( mPageView, SIGNAL( clicked( QListViewItem* ) ), - this, SLOT( itemClicked( QListViewItem* ) ) ); + connect( mPageView, TQT_SIGNAL( selectionChanged( TQListViewItem* ) ), + this, TQT_SLOT( updatePreview( TQListViewItem* ) ) ); + connect( mPageView, TQT_SIGNAL( clicked( TQListViewItem* ) ), + this, TQT_SLOT( itemClicked( TQListViewItem* ) ) ); - connect( mDeleteButton, SIGNAL( clicked() ), - this, SLOT( deleteFile() ) ); - connect( mImportButton, SIGNAL( clicked() ), - this, SLOT( importFile() ) ); - connect( mDesignerButton, SIGNAL( clicked() ), - this, SLOT( startDesigner() ) ); + connect( mDeleteButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( deleteFile() ) ); + connect( mImportButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( importFile() ) ); + connect( mDesignerButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( startDesigner() ) ); load(); // Install a dirwatcher that will detect newly created or removed designer files KDirWatch *dw = new KDirWatch( this ); dw->addDir( localUiDir(), true ); - connect( dw, SIGNAL( created(const QString&) ), SLOT( rebuildList() ) ); - connect( dw, SIGNAL( deleted(const QString&) ), SLOT( rebuildList() ) ); - connect( dw, SIGNAL( dirty(const QString&) ), SLOT( rebuildList() ) ); + connect( dw, TQT_SIGNAL( created(const TQString&) ), TQT_SLOT( rebuildList() ) ); + connect( dw, TQT_SIGNAL( deleted(const TQString&) ), TQT_SLOT( rebuildList() ) ); + connect( dw, TQT_SIGNAL( dirty(const TQString&) ), TQT_SLOT( rebuildList() ) ); } void KCMDesignerFields::deleteFile() { - QListViewItem *item = mPageView->selectedItem(); + TQListViewItem *item = mPageView->selectedItem(); if ( item ) { PageItem *pageItem = static_cast<PageItem*>( item->parent() ? item->parent() : item ); if (KMessageBox::warningContinueCancel(this, @@ -184,7 +184,7 @@ void KCMDesignerFields::deleteFile() void KCMDesignerFields::importFile() { - KURL src = KFileDialog::getOpenFileName( QDir::homeDirPath(), i18n("*.ui|Designer Files"), + KURL src = KFileDialog::getOpenFileName( TQDir::homeDirPath(), i18n("*.ui|Designer Files"), this, i18n("Import Page") ); KURL dest = localUiDir(); dest.setFileName(src.fileName()); @@ -195,24 +195,24 @@ void KCMDesignerFields::importFile() void KCMDesignerFields::loadUiFiles() { - QStringList list = KGlobal::dirs()->findAllResources( "data", uiPath() + "/*.ui", true, true ); - for ( QStringList::iterator it = list.begin(); it != list.end(); ++it ) { + TQStringList list = KGlobal::dirs()->findAllResources( "data", uiPath() + "/*.ui", true, true ); + for ( TQStringList::iterator it = list.begin(); it != list.end(); ++it ) { new PageItem( mPageView, *it ); } } void KCMDesignerFields::rebuildList() { - QStringList ai = saveActivePages(); + TQStringList ai = saveActivePages(); updatePreview( 0 ); mPageView->clear(); loadUiFiles(); loadActivePages(ai); } -void KCMDesignerFields::loadActivePages(const QStringList& ai) +void KCMDesignerFields::loadActivePages(const TQStringList& ai) { - QListViewItemIterator it( mPageView ); + TQListViewItemIterator it( mPageView ); while ( it.current() ) { if ( it.current()->parent() == 0 ) { PageItem *item = static_cast<PageItem*>( it.current() ); @@ -231,12 +231,12 @@ void KCMDesignerFields::load() loadActivePages( readActivePages() ); } -QStringList KCMDesignerFields::saveActivePages() +TQStringList KCMDesignerFields::saveActivePages() { - QListViewItemIterator it( mPageView, QListViewItemIterator::Checked | - QListViewItemIterator::Selectable ); + TQListViewItemIterator it( mPageView, TQListViewItemIterator::Checked | + TQListViewItemIterator::Selectable ); - QStringList activePages; + TQStringList activePages; while ( it.current() ) { if ( it.current()->parent() == 0 ) { PageItem *item = static_cast<PageItem*>( it.current() ); @@ -260,21 +260,21 @@ void KCMDesignerFields::defaults() void KCMDesignerFields::initGUI() { - QVBoxLayout *layout = new QVBoxLayout( this, KDialog::marginHint(), + TQVBoxLayout *layout = new TQVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); bool noDesigner = KStandardDirs::findExe("designer").isEmpty(); if ( noDesigner ) { - QString txt = + TQString txt = i18n("<qt><b>Warning:</b> Qt Designer could not be found. It is probably not " "installed. You will only be able to import existing designer files.</qt>"); - QLabel *lbl = new QLabel( txt, this ); + TQLabel *lbl = new TQLabel( txt, this ); layout->addWidget( lbl ); } - QHBoxLayout *hbox = new QHBoxLayout( layout, KDialog::spacingHint() ); + TQHBoxLayout *hbox = new TQHBoxLayout( layout, KDialog::spacingHint() ); mPageView = new KListView( this ); mPageView->addColumn( i18n( "Available Pages" ) ); @@ -283,20 +283,20 @@ void KCMDesignerFields::initGUI() mPageView->setFullWidth( true ); hbox->addWidget( mPageView ); - QGroupBox *box = new QGroupBox(1, Qt::Horizontal, i18n("Preview of Selected Page"), this ); + TQGroupBox *box = new TQGroupBox(1, Qt::Horizontal, i18n("Preview of Selected Page"), this ); - mPagePreview = new QLabel( box ); + mPagePreview = new TQLabel( box ); mPagePreview->setMinimumWidth( 300 ); - mPageDetails = new QLabel( box ); + mPageDetails = new TQLabel( box ); hbox->addWidget( box ); loadUiFiles(); - hbox = new QHBoxLayout( layout, KDialog::spacingHint() ); + hbox = new TQHBoxLayout( layout, KDialog::spacingHint() ); - QString cwHowto = i18n("<qt><p>This section allows you to add your own GUI" + TQString cwHowto = i18n("<qt><p>This section allows you to add your own GUI" " Elements ('<i>Widgets</i>') to store your own values" " into %1. Proceed as described below:</p>" "<ol>" @@ -322,16 +322,16 @@ void KCMDesignerFields::initGUI() hbox->addWidget( activeLabel ); // ### why is this needed? Looks like a KActiveLabel bug... - activeLabel->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ); + activeLabel->setSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Maximum ); hbox->addStretch( 1 ); - mDeleteButton = new QPushButton( i18n( "Delete Page" ), this); + mDeleteButton = new TQPushButton( i18n( "Delete Page" ), this); mDeleteButton->setEnabled( false ); hbox->addWidget( mDeleteButton ); - mImportButton = new QPushButton( i18n( "Import Page..." ), this); + mImportButton = new TQPushButton( i18n( "Import Page..." ), this); hbox->addWidget( mImportButton ); - mDesignerButton = new QPushButton( i18n( "Edit with Qt Designer..." ), this ); + mDesignerButton = new TQPushButton( i18n( "Edit with Qt Designer..." ), this ); hbox->addWidget( mDesignerButton ); if ( noDesigner ) @@ -347,13 +347,13 @@ void KCMDesignerFields::initGUI() mDesignerButton->show(); } -void KCMDesignerFields::updatePreview( QListViewItem *item ) +void KCMDesignerFields::updatePreview( TQListViewItem *item ) { bool widgetItemSelected = false; if ( item ) { if ( item->parent() ) { - QString details = QString( "<qt><table>" + TQString details = TQString( "<qt><table>" "<tr><td align=\"right\"><b>%1</b></td><td>%2</td></tr>" "<tr><td align=\"right\"><b>%3</b></td><td>%4</td></tr>" "<tr><td align=\"right\"><b>%5</b></td><td>%6</td></tr>" @@ -373,7 +373,7 @@ void KCMDesignerFields::updatePreview( QListViewItem *item ) PageItem *pageItem = static_cast<PageItem*>( item->parent() ); mPagePreview->setPixmap( pageItem->preview() ); } else { - mPageDetails->setText( QString::null ); + mPageDetails->setText( TQString::null ); PageItem *pageItem = static_cast<PageItem*>( item ); mPagePreview->setPixmap( pageItem->preview() ); @@ -381,17 +381,17 @@ void KCMDesignerFields::updatePreview( QListViewItem *item ) widgetItemSelected = true; } - mPagePreview->setFrameStyle( QFrame::Panel | QFrame::Sunken ); + mPagePreview->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); } else { - mPagePreview->setPixmap( QPixmap() ); + mPagePreview->setPixmap( TQPixmap() ); mPagePreview->setFrameStyle( 0 ); - mPageDetails->setText( QString::null ); + mPageDetails->setText( TQString::null ); } mDeleteButton->setEnabled( widgetItemSelected ); } -void KCMDesignerFields::itemClicked( QListViewItem *item ) +void KCMDesignerFields::itemClicked( TQListViewItem *item ) { if ( !item || item->parent() != 0 ) return; @@ -406,10 +406,10 @@ void KCMDesignerFields::itemClicked( QListViewItem *item ) void KCMDesignerFields::startDesigner() { - QString cmdLine = "designer"; + TQString cmdLine = "designer"; // check if path exists and create one if not. - QString cepPath = localUiDir(); + TQString cepPath = localUiDir(); if( !KGlobal::dirs()->exists(cepPath) ) { KIO::NetAccess::mkdir( cepPath, this ); } @@ -417,7 +417,7 @@ void KCMDesignerFields::startDesigner() // finally jump there chdir(cepPath.local8Bit()); - QListViewItem *item = mPageView->selectedItem(); + TQListViewItem *item = mPageView->selectedItem(); if ( item ) { PageItem *pageItem = static_cast<PageItem*>( item->parent() ? item->parent() : item ); cmdLine += " " + KProcess::quote( pageItem->path() ); |