diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
commit | aa0726b20f398264f0a2abc60215be044b106f9c (patch) | |
tree | 070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/kicondialog.cpp | |
parent | d3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff) | |
download | basket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip |
TQt4 port basket
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kicondialog.cpp')
-rw-r--r-- | src/kicondialog.cpp | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/src/kicondialog.cpp b/src/kicondialog.cpp index e5bf262..d9317b9 100644 --- a/src/kicondialog.cpp +++ b/src/kicondialog.cpp @@ -34,21 +34,21 @@ #include <kpushbutton.h> #include <kmessagebox.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qsortedlist.h> -#include <qimage.h> -#include <qpixmap.h> -#include <qlabel.h> -#include <qcombobox.h> -#include <qtimer.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qfileinfo.h> -#include <qtoolbutton.h> -#include <qwhatsthis.h> -#include <qhbuttongroup.h> -#include <qdragobject.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqsortedlist.h> +#include <tqimage.h> +#include <tqpixmap.h> +#include <tqlabel.h> +#include <tqcombobox.h> +#include <tqtimer.h> +#include <tqbuttongroup.h> +#include <tqradiobutton.h> +#include <tqfileinfo.h> +#include <tqtoolbutton.h> +#include <tqwhatsthis.h> +#include <tqhbuttongroup.h> +#include <tqdragobject.h> /* NOTE: Must be in the same order as listbox */ enum ExtendedContext @@ -67,10 +67,10 @@ class KIconDialog::KIconDialogPrivate } ~KIconDialogPrivate() {} bool m_bStrictIconSize; - QString custom; - QString customLocation; + TQString custom; + TQString customLocation; int recentMax; - QStringList recentList; + TQStringList recentList; ExtendedContext extendedContext; KIconDialogUI *ui; /* FIXME: KDE4 probably move this to the main class */ }; @@ -80,18 +80,18 @@ class KIconDialog::KIconDialogPrivate * specified icons can be chosen. */ -KIconDialog::KIconDialog(QWidget *parent, const char*) - : KDialogBase(parent, "IconDialog", true, i18n("Select Icon"), Ok|Cancel, Ok) +KIconDialog::KIconDialog(TQWidget *tqparent, const char*) + : KDialogBase(tqparent, "IconDialog", true, i18n("Select Icon"), Ok|Cancel, Ok) { d = new KIconDialogPrivate; mpLoader = KGlobal::iconLoader(); init(); - resize(minimumSize()); + resize(tqminimumSize()); } -KIconDialog::KIconDialog(KIconLoader *loader, QWidget *parent, +KIconDialog::KIconDialog(KIconLoader *loader, TQWidget *tqparent, const char *name) - : KDialogBase(parent, name, true, i18n("Select Icon"), Ok|Cancel, Ok) + : KDialogBase(tqparent, name, true, i18n("Select Icon"), Ok|Cancel, Ok) { d = new KIconDialogPrivate; mpLoader = loader; @@ -103,7 +103,7 @@ void KIconDialog::init() mGroupOrSize = KIcon::Desktop; d->extendedContext = ALL; mType = 0; - setCustomLocation(QString::null); // Initialize mFileList + setCustomLocation(TQString()); // Initialize mFileList // Read configuration KConfig *config = KGlobal::config(); @@ -120,14 +120,14 @@ void KIconDialog::init() // Hack standard Gui item, as KDevDesigner won't let us d->ui->browseButton->setText(i18n("&Browse...")); - connect(d->ui->browseButton, SIGNAL(clicked()), SLOT(slotBrowse())); - connect(d->ui->listBox, SIGNAL(highlighted(int)), SLOT(slotContext(int))); - connect(d->ui->iconCanvas, SIGNAL(executed(QIconViewItem *)), SLOT(slotOk())); - connect(d->ui->iconCanvas, SIGNAL(returnPressed(QIconViewItem *)), SLOT(slotOk())); - connect(d->ui->iconCanvas, SIGNAL(startLoading(int)), SLOT(slotStartLoading(int))); - connect(d->ui->iconCanvas, SIGNAL(progress(int)), SLOT(slotProgress(int))); - connect(d->ui->iconCanvas, SIGNAL(finished()), SLOT(slotFinished())); - connect(this, SIGNAL(hidden()), d->ui->iconCanvas, SLOT(stopLoading())); + connect(d->ui->browseButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotBrowse())); + connect(d->ui->listBox, TQT_SIGNAL(highlighted(int)), TQT_SLOT(slotContext(int))); + connect(d->ui->iconCanvas, TQT_SIGNAL(executed(TQIconViewItem *)), TQT_SLOT(slotOk())); + connect(d->ui->iconCanvas, TQT_SIGNAL(returnPressed(TQIconViewItem *)), TQT_SLOT(slotOk())); + connect(d->ui->iconCanvas, TQT_SIGNAL(startLoading(int)), TQT_SLOT(slotStartLoading(int))); + connect(d->ui->iconCanvas, TQT_SIGNAL(progress(int)), TQT_SLOT(slotProgress(int))); + connect(d->ui->iconCanvas, TQT_SIGNAL(finished()), TQT_SLOT(slotFinished())); + connect(this, TQT_SIGNAL(hidden()), d->ui->iconCanvas, TQT_SLOT(stopLoading())); // NOTE: this must be consistent with the IconType enum (see above) d->ui->listBox->insertItem(i18n("(All Icons)")); @@ -159,7 +159,7 @@ void KIconDialog::slotAcceptIcons() void KIconDialog::showIcons() { d->ui->iconCanvas->clear(); - QStringList filelist; + TQStringList filelist; KIcon::Context context = static_cast<KIcon::Context>(d->extendedContext - 1); switch (d->extendedContext) @@ -175,21 +175,21 @@ void KIconDialog::showIcons() context = KIcon::Any; // ** Fallthrough to next case ** default: - QStringList list; + TQStringList list; if (d->m_bStrictIconSize) list=mpLoader->queryIcons(mGroupOrSize, context); else list=mpLoader->queryIconsByContext(mGroupOrSize, context); // Remove path & extension - for ( QStringList::iterator it = list.begin(); it != list.end(); ++it) - filelist.append(QFileInfo(*it).baseName()); + for ( TQStringList::iterator it = list.begin(); it != list.end(); ++it) + filelist.append(TQFileInfo(*it).baseName()); } - // Remove duplicate icons FIXME: Qt4 we can just use QSet + // Remove duplicate icons FIXME: TQt4 we can just use TQSet filelist.sort(); - QString prev; - for ( QStringList::iterator it = filelist.begin(); it != filelist.end(); ) + TQString prev; + for ( TQStringList::iterator it = filelist.begin(); it != filelist.end(); ) { if (*it == prev) { @@ -232,7 +232,7 @@ int KIconDialog::iconSize() const } #ifndef KDE_NO_COMPAT -QString KIconDialog::selectIcon(KIcon::Group group, KIcon::Context context, bool user) +TQString KIconDialog::selectIcon(KIcon::Group group, KIcon::Context context, bool user) { setup( group, context, false, 0, user ); return openDialog(); @@ -256,8 +256,8 @@ void KIconDialog::setup(KIcon::Group group, KIcon::Context context, d->extendedContext = static_cast<ExtendedContext>( ( context == KIcon::Any ) ? ALL : context + 1 ); - // We cannot change layout because it is protected ;-( - // FIXME: Qt4 we will be able to inherit from both QDialog and our GUI + // We cannot change tqlayout because it is protected ;-( + // FIXME: TQt4 we will be able to inherit from both TQDialog and our GUI d->ui->listBox->setEnabled(!lockContext); d->ui->browseButton->setEnabled(!lockBrowse); d->ui->listBox->setHidden(lockContext && lockBrowse); @@ -266,24 +266,24 @@ void KIconDialog::setup(KIcon::Group group, KIcon::Context context, d->ui->listBox->setCurrentItem(d->extendedContext); } -const QString & KIconDialog::customLocation( ) const +const TQString & KIconDialog::customLocation( ) const { return d->customLocation; } -void KIconDialog::setCustomLocation( const QString& location ) +void KIconDialog::setCustomLocation( const TQString& location ) { d->customLocation = location; if (location.isEmpty()) { - mFileList = KGlobal::dirs()->findAllResources("appicon", QString::fromLatin1("*.png")); + mFileList = KGlobal::dirs()->findAllResources("appicon", TQString::tqfromLatin1("*.png")); } else { mFileList = mpLoader->queryIconsByDir(location); } } -QString KIconDialog::openDialog() +TQString KIconDialog::openDialog() { showIcons(); @@ -296,15 +296,15 @@ QString KIconDialog::openDialog() } else { - return QString::null; + return TQString(); } } void KIconDialog::showDialog() { - d->custom = QString::null; + d->custom = TQString(); - // Make it so minimumSize returns correct value + // Make it so tqminimumSize returns correct value d->ui->filterLabel->hide(); d->ui->searchLine->hide(); d->ui->progressBar->show(); @@ -313,17 +313,17 @@ void KIconDialog::showDialog() show(); // FIXME: this should be before show() but it doesn't work ;-( - resize(minimumSize()); + resize(tqminimumSize()); showIcons(); } void KIconDialog::slotOk() { - QString key = !d->custom.isEmpty() ? d->custom : d->ui->iconCanvas->getCurrent(); + TQString key = !d->custom.isEmpty() ? d->custom : d->ui->iconCanvas->getCurrent(); // Append to list of recent icons - if (!d->recentList.contains(key)) + if (!d->recentList.tqcontains(key)) { d->recentList.push_back(key); @@ -336,11 +336,11 @@ void KIconDialog::slotOk() KDialogBase::slotOk(); } -QString KIconDialog::getIcon(KIcon::Group group, KIcon::Context context, +TQString KIconDialog::getIcon(KIcon::Group group, KIcon::Context context, bool strictIconSize, int iconSize, bool user, - QWidget *parent, const QString &caption) + TQWidget *tqparent, const TQString &caption) { - KIconDialog dlg(parent, "icon dialog"); + KIconDialog dlg(tqparent, "icon dialog"); dlg.setup( group, context, strictIconSize, iconSize, user ); if (!caption.isNull()) dlg.setCaption(caption); @@ -353,7 +353,7 @@ void KIconDialog::slotBrowse() // Create a file dialog to select a PNG, XPM or SVG file, // with the image previewer shown. // KFileDialog::getImageOpenURL doesn't allow svg. - KFileDialog dlg(QString::null, i18n("*.png *.xpm *.svg *.svgz|Icon Files (*.png *.xpm *.svg *.svgz)"), + KFileDialog dlg(TQString(), i18n("*.png *.xpm *.svg *.svgz|Icon Files (*.png *.xpm *.svg *.svgz)"), this, "filedialog", true); dlg.setOperationMode( KFileDialog::Opening ); dlg.setCaption( i18n("Open") ); @@ -362,12 +362,12 @@ void KIconDialog::slotBrowse() dlg.setPreviewWidget( ip ); dlg.exec(); - QString file = dlg.selectedFile(); + TQString file = dlg.selectedFile(); if (!file.isEmpty()) { d->custom = file; if ( mType == 1 ) - setCustomLocation(QFileInfo( file ).dirPath( true )); + setCustomLocation(TQFileInfo( file ).dirPath( true )); slotOk(); } } @@ -423,15 +423,15 @@ class KIconButton::KIconButtonPrivate * KIconButton: A "choose icon" pushbutton. */ -KIconButton::KIconButton(QWidget *parent, const char *name) - : QPushButton(parent, name) +KIconButton::KIconButton(TQWidget *tqparent, const char *name) + : TQPushButton(tqparent, name) { init( KGlobal::iconLoader() ); } KIconButton::KIconButton(KIconLoader *loader, - QWidget *parent, const char *name) - : QPushButton(parent, name) + TQWidget *tqparent, const char *name) + : TQPushButton(tqparent, name) { init( loader ); } @@ -445,7 +445,7 @@ void KIconButton::init( KIconLoader *loader ) mpLoader = loader; mpDialog = 0L; - connect(this, SIGNAL(clicked()), SLOT(slotChangeIcon())); + connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(slotChangeIcon())); } KIconButton::~KIconButton() @@ -492,7 +492,7 @@ void KIconButton::setIconType(KIcon::Group group, KIcon::Context context, bool u d->lockCustom = lockCustom; } -void KIconButton::setIcon(const QString& icon) +void KIconButton::setIcon(const TQString& icon) { mIcon = icon; setIconSet(mpLoader->loadIconSet(mIcon, mGroup, d->iconSize)); @@ -500,21 +500,21 @@ void KIconButton::setIcon(const QString& icon) if (!mpDialog) { mpDialog = new KIconDialog(mpLoader, this); - connect(mpDialog, SIGNAL(newIconName(const QString&)), SLOT(newIconName(const QString&))); + connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&))); } } -const QString & KIconButton::customLocation( ) const +const TQString & KIconButton::customLocation( ) const { - return mpDialog ? mpDialog->customLocation() : QString::null; + return mpDialog ? mpDialog->customLocation() : TQString(); } -void KIconButton::setCustomLocation(const QString &custom) +void KIconButton::setCustomLocation(const TQString &custom) { if (!mpDialog) { mpDialog = new KIconDialog(mpLoader, this); - connect(mpDialog, SIGNAL(newIconName(const QString&)), SLOT(newIconName(const QString&))); + connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&))); } mpDialog->setCustomLocation(custom); @@ -522,8 +522,8 @@ void KIconButton::setCustomLocation(const QString &custom) void KIconButton::resetIcon() { - mIcon = QString::null; - setIconSet(QIconSet()); + mIcon = TQString(); + setIconSet(TQIconSet()); } void KIconButton::slotChangeIcon() @@ -531,19 +531,19 @@ void KIconButton::slotChangeIcon() if (!mpDialog) { mpDialog = new KIconDialog(mpLoader, this); - connect(mpDialog, SIGNAL(newIconName(const QString&)), SLOT(newIconName(const QString&))); + connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&))); } mpDialog->setup( mGroup, mContext, d->m_bStrictIconSize, d->iconSize, mbUser, d->lockUser, d->lockCustom ); mpDialog->showDialog(); } -void KIconButton::newIconName(const QString& name) +void KIconButton::newIconName(const TQString& name) { if (name.isEmpty()) return; - QIconSet iconset = mpLoader->loadIconSet(name, mGroup, d->iconSize); + TQIconSet iconset = mpLoader->loadIconSet(name, mGroup, d->iconSize); setIconSet(iconset); mIcon = name; |