diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
commit | bf7f88413be3831a9372d323d02fc0335b9f9188 (patch) | |
tree | 516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/externaltooldialog.cpp | |
parent | e238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff) | |
download | gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip |
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/externaltooldialog.cpp')
-rw-r--r-- | src/gvcore/externaltooldialog.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/src/gvcore/externaltooldialog.cpp b/src/gvcore/externaltooldialog.cpp index e8b0809..1835fc9 100644 --- a/src/gvcore/externaltooldialog.cpp +++ b/src/gvcore/externaltooldialog.cpp @@ -1,7 +1,7 @@ // vim: set tabstop=4 shiftwidth=4 noexpandtab /* Gwenview - A simple image viewer for KDE -Copyright 2000-2004 Aurélien Gâteau +Copyright 2000-2004 Aur�lien G�teau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -18,10 +18,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// Qt -#include <qbuttongroup.h> -#include <qheader.h> -#include <qwhatsthis.h> +// TQt +#include <tqbuttongroup.h> +#include <tqheader.h> +#include <tqwhatsthis.h> // KDE #include <kdebug.h> @@ -51,8 +51,8 @@ enum { ID_ALL_IMAGES=0, ID_ALL_FILES, ID_CUSTOM }; class ToolListViewItem : public KListViewItem { public: - ToolListViewItem(KListView* parent, const QString& label) - : KListViewItem(parent, label), mDesktopFile(0L) {} + ToolListViewItem(KListView* tqparent, const TQString& label) + : KListViewItem(tqparent, label), mDesktopFile(0L) {} void setDesktopFile(KDesktopFile* df) { mDesktopFile=df; @@ -69,7 +69,7 @@ private: struct ExternalToolDialogPrivate { ExternalToolDialogBase* mContent; - QPtrList<KDesktopFile> mDeletedTools; + TQPtrList<KDesktopFile> mDeletedTools; ToolListViewItem* mSelectedItem; @@ -77,21 +77,21 @@ struct ExternalToolDialogPrivate { : mSelectedItem(0L) {} void fillMimeTypeListView() { - QStringList mimeTypes=MimeTypeUtils::rasterImageMimeTypes(); + TQStringList mimeTypes=MimeTypeUtils::rasterImageMimeTypes(); mimeTypes.append("inode/directory"); mimeTypes+=Archive::mimeTypes(); - QStringList::const_iterator it=mimeTypes.begin(); + TQStringList::const_iterator it=mimeTypes.begin(); for(; it!=mimeTypes.end(); ++it) { - (void)new QCheckListItem(mContent->mMimeTypeListView, *it, QCheckListItem::CheckBox); + (void)new TQCheckListItem(mContent->mMimeTypeListView, *it, TQCheckListItem::CheckBox); } } void fillToolListView() { - QDict<KDesktopFile> desktopFiles=ExternalToolManager::instance()->desktopFiles(); + TQDict<KDesktopFile> desktopFiles=ExternalToolManager::instance()->desktopFiles(); - QDictIterator<KDesktopFile> it(desktopFiles); + TQDictIterator<KDesktopFile> it(desktopFiles); for (; it.current(); ++it) { ToolListViewItem* item=new ToolListViewItem(mContent->mToolListView, it.current()->readName()); item->setPixmap(0, SmallIcon(it.current()->readIcon()) ); @@ -103,7 +103,7 @@ struct ExternalToolDialogPrivate { void writeServiceTypes(KDesktopFile* desktopFile) { - QButton* button=mContent->mFileAssociationGroup->selected(); + TQButton* button=mContent->mFileAssociationGroup->selected(); if (!button) { desktopFile->writeEntry("ServiceTypes", "*"); return; @@ -119,10 +119,10 @@ struct ExternalToolDialogPrivate { return; } - QStringList mimeTypes; - QListViewItem* item=mContent->mMimeTypeListView->firstChild(); + TQStringList mimeTypes; + TQListViewItem* item=mContent->mMimeTypeListView->firstChild(); for (; item; item=item->nextSibling()) { - if (static_cast<QCheckListItem*>(item)->isOn()) { + if (static_cast<TQCheckListItem*>(item)->isOn()) { mimeTypes.append(item->text(0)); } } @@ -134,17 +134,17 @@ struct ExternalToolDialogPrivate { if (!mSelectedItem) return true; // Check name - QString name=mContent->mName->text().stripWhiteSpace(); + TQString name=mContent->mName->text().stripWhiteSpace(); if (name.isEmpty()) { KMessageBox::sorry(mContent, i18n("The tool name cannot be empty")); return false; } - QListViewItem* item=mContent->mToolListView->firstChild(); + TQListViewItem* item=mContent->mToolListView->firstChild(); for (; item; item=item->nextSibling()) { if (item==mSelectedItem) continue; if (name==item->text(0)) { - KMessageBox::sorry(mContent, i18n("There is already a tool named \"%1\"").arg(name)); + KMessageBox::sorry(mContent, i18n("There is already a tool named \"%1\"").tqarg(name)); return false; } } @@ -172,10 +172,10 @@ struct ExternalToolDialogPrivate { } - void updateFileAssociationGroup(const QStringList& serviceTypes) { - QListViewItem* item=mContent->mMimeTypeListView->firstChild(); + void updateFileAssociationGroup(const TQStringList& serviceTypes) { + TQListViewItem* item=mContent->mMimeTypeListView->firstChild(); for (; item; item=item->nextSibling()) { - static_cast<QCheckListItem*>(item)->setOn(false); + static_cast<TQCheckListItem*>(item)->setOn(false); } if (serviceTypes.size()==0) { @@ -183,7 +183,7 @@ struct ExternalToolDialogPrivate { return; } if (serviceTypes.size()==1) { - QString serviceType=serviceTypes[0]; + TQString serviceType=serviceTypes[0]; if (serviceType=="image/*") { mContent->mFileAssociationGroup->setButton(ID_ALL_IMAGES); return; @@ -195,11 +195,11 @@ struct ExternalToolDialogPrivate { } mContent->mFileAssociationGroup->setButton(ID_CUSTOM); - QStringList::ConstIterator it=serviceTypes.begin(); + TQStringList::ConstIterator it=serviceTypes.begin(); for (;it!=serviceTypes.end(); ++it) { - QListViewItem* item= - mContent->mMimeTypeListView->findItem(*it, 0, Qt::ExactMatch); - if (item) static_cast<QCheckListItem*>(item)->setOn(true); + TQListViewItem* item= + mContent->mMimeTypeListView->tqfindItem(*it, 0, TQt::ExactMatch); + if (item) static_cast<TQCheckListItem*>(item)->setOn(true); } } @@ -213,21 +213,21 @@ struct ExternalToolDialogPrivate { mContent->mName->setText(desktopFile->readName()); mContent->mCommand->setURL(desktopFile->readEntry("Exec")); mContent->mIconButton->setIcon(desktopFile->readIcon()); - QStringList serviceTypes=desktopFile->readListEntry("ServiceTypes"); + TQStringList serviceTypes=desktopFile->readListEntry("ServiceTypes"); updateFileAssociationGroup(serviceTypes); return; } } - mContent->mName->setText(QString::null); - mContent->mCommand->setURL(QString::null); - mContent->mIconButton->setIcon(QString::null); + mContent->mName->setText(TQString()); + mContent->mCommand->setURL(TQString()); + mContent->mIconButton->setIcon(TQString()); mContent->mFileAssociationGroup->setButton(ID_ALL_IMAGES); } bool apply() { if (!saveChanges()) return false; - QPtrListIterator<KDesktopFile> it(mDeletedTools); + TQPtrListIterator<KDesktopFile> it(mDeletedTools); for(; it.current(); ++it) { ExternalToolManager::instance()->hideDesktopFile(it.current()); } @@ -241,25 +241,25 @@ struct ExternalToolDialogPrivate { * This event filter object is here to prevent the user from selecting a * different tool in the tool list view if the current tool could not be saved. */ -class ToolListViewFilterObject : public QObject { +class ToolListViewFilterObject : public TQObject { ExternalToolDialogPrivate* d; public: - ToolListViewFilterObject(QObject* parent, ExternalToolDialogPrivate* _d) - : QObject(parent), d(_d) {} + ToolListViewFilterObject(TQObject* tqparent, ExternalToolDialogPrivate* _d) + : TQObject(tqparent), d(_d) {} - bool eventFilter(QObject*, QEvent* event) { - if (event->type()!=QEvent::MouseButtonPress) return false; + bool eventFilter(TQObject*, TQEvent* event) { + if (event->type()!=TQEvent::MouseButtonPress) return false; return !d->saveChanges(); } }; -ExternalToolDialog::ExternalToolDialog(QWidget* parent) +ExternalToolDialog::ExternalToolDialog(TQWidget* tqparent) : KDialogBase( - parent,0, false, QString::null, KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, + tqparent,0, false, TQString(), KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, KDialogBase::Ok, true) { - setWFlags(getWFlags() | Qt::WDestructiveClose); + setWFlags(getWFlags() | TQt::WDestructiveClose); d=new ExternalToolDialogPrivate; d->mContent=new ExternalToolDialogBase(this); @@ -272,18 +272,18 @@ ExternalToolDialog::ExternalToolDialog(QWidget* parent) d->fillMimeTypeListView(); d->fillToolListView(); d->mContent->mToolListView->viewport()->installEventFilter( - new ToolListViewFilterObject(this, d)); - - connect( d->mContent->mToolListView, SIGNAL(selectionChanged(QListViewItem*)), - this, SLOT(slotSelectionChanged(QListViewItem*)) ); - connect( d->mContent->mAddButton, SIGNAL(clicked()), - this, SLOT(addTool()) ); - connect( d->mContent->mDeleteButton, SIGNAL(clicked()), - this, SLOT(deleteTool()) ); - connect( d->mContent->mHelp, SIGNAL(leftClickedURL()), - this, SLOT(showCommandHelp()) ); - connect( d->mContent->mMoreTools, SIGNAL(leftClickedURL(const QString&)), - this, SLOT(openURL(const QString&)) ); + new ToolListViewFilterObject(TQT_TQOBJECT(this), d)); + + connect( d->mContent->mToolListView, TQT_SIGNAL(selectionChanged(TQListViewItem*)), + this, TQT_SLOT(slotSelectionChanged(TQListViewItem*)) ); + connect( d->mContent->mAddButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(addTool()) ); + connect( d->mContent->mDeleteButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(deleteTool()) ); + connect( d->mContent->mHelp, TQT_SIGNAL(leftClickedURL()), + this, TQT_SLOT(showCommandHelp()) ); + connect( d->mContent->mMoreTools, TQT_SIGNAL(leftClickedURL(const TQString&)), + this, TQT_SLOT(openURL(const TQString&)) ); KListView* view=d->mContent->mToolListView; if (view->firstChild()) { @@ -314,7 +314,7 @@ void ExternalToolDialog::slotCancel() { } -void ExternalToolDialog::slotSelectionChanged(QListViewItem* item) { +void ExternalToolDialog::slotSelectionChanged(TQListViewItem* item) { d->mSelectedItem=static_cast<ToolListViewItem*>(item); d->updateDetails(); } @@ -322,7 +322,7 @@ void ExternalToolDialog::slotSelectionChanged(QListViewItem* item) { void ExternalToolDialog::addTool() { KListView* view=d->mContent->mToolListView; - QString name=i18n("<Unnamed tool>"); + TQString name=i18n("<Unnamed tool>"); ToolListViewItem* item=new ToolListViewItem(view, name); view->setSelected(item, true); } @@ -343,12 +343,12 @@ void ExternalToolDialog::deleteTool() { void ExternalToolDialog::showCommandHelp() { KURLRequester* lbl=d->mContent->mCommand; - QWhatsThis::display(QWhatsThis::textFor(lbl), + TQWhatsThis::display(TQWhatsThis::textFor(lbl), lbl->mapToGlobal( lbl->rect().bottomRight() ) ); } -void ExternalToolDialog::openURL(const QString& url) { +void ExternalToolDialog::openURL(const TQString& url) { new KRun(KURL(url)); } |