diff options
Diffstat (limited to 'kkbswitch/kbpickicondlg.cpp')
-rw-r--r-- | kkbswitch/kbpickicondlg.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/kkbswitch/kbpickicondlg.cpp b/kkbswitch/kbpickicondlg.cpp index d745f7c..c4dc299 100644 --- a/kkbswitch/kbpickicondlg.cpp +++ b/kkbswitch/kbpickicondlg.cpp @@ -17,11 +17,11 @@ #include "kbpickicondlg.h" -#include <qvbox.h> -#include <qdir.h> -#include <qwhatsthis.h> -#include <qpushbutton.h> -#include <qimage.h> +#include <ntqvbox.h> +#include <ntqdir.h> +#include <ntqwhatsthis.h> +#include <ntqpushbutton.h> +#include <ntqimage.h> #include <kdeversion.h> #include <klocale.h> @@ -37,21 +37,21 @@ #include "kbconfig.h" #include "pathlistboxitem.h" -KBPickIconDlg::KBPickIconDlg(const QString ¤tPath, const QPixmap ¤tPixmap, - QWidget *parent, const char *name ) +KBPickIconDlg::KBPickIconDlg(const TQString ¤tPath, const TQPixmap ¤tPixmap, + TQWidget *parent, const char *name ) : KDialogBase(parent, name, true /*modal*/, i18n("Pick an icon") /*caption*/, Ok | Cancel) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); lbIcons = new KListBox(page); - QObject::connect(lbIcons, SIGNAL(doubleClicked(QListBoxItem*)), + TQObject::connect(lbIcons, SIGNAL(doubleClicked(TQListBoxItem*)), this, SLOT(slotOk())); - QObject::connect(lbIcons, SIGNAL(returnPressed(QListBoxItem*)), + TQObject::connect(lbIcons, SIGNAL(returnPressed(TQListBoxItem*)), this, SLOT(slotOk())); - QWhatsThis::add(lbIcons, i18n("Select one of the icons")); + TQWhatsThis::add(lbIcons, i18n("Select one of the icons")); - QPushButton *btnBrowse = new QPushButton(i18n("&Browse..."), page); - QObject::connect(btnBrowse, SIGNAL(clicked()), this, SLOT(slotBrowseForIcon())); - QWhatsThis::add(btnBrowse, i18n("Browse for an image file to use as an icon")); + TQPushButton *btnBrowse = new TQPushButton(i18n("&Browse..."), page); + TQObject::connect(btnBrowse, SIGNAL(clicked()), this, SLOT(slotBrowseForIcon())); + TQWhatsThis::add(btnBrowse, i18n("Browse for an image file to use as an icon")); loadCountryFlags(); @@ -69,15 +69,15 @@ KBPickIconDlg::~KBPickIconDlg(){ } /** Get the path name of the selected icon. Returns empty string if no icon selected */ -QString KBPickIconDlg::getIconPath(){ - QListBoxItem *item = lbIcons->selectedItem(); +TQString KBPickIconDlg::getIconPath(){ + TQListBoxItem *item = lbIcons->selectedItem(); if (item) return dynamic_cast<PathListBoxItem*>(item)->path; - else return QString::null; // should not happen + else return TQString::null; // should not happen } /** No descriptions */ -const QPixmap* KBPickIconDlg::getIcon(){ +const TQPixmap* KBPickIconDlg::getIcon(){ if (lbIcons->currentItem() != -1) return lbIcons->pixmap(lbIcons->currentItem()); else return NULL; @@ -86,13 +86,13 @@ const QPixmap* KBPickIconDlg::getIcon(){ /** Browse for an arbitrary icon file */ void KBPickIconDlg::slotBrowseForIcon() { - QString iconPath = KFileDialog::getOpenFileName(QString::null, + TQString iconPath = KFileDialog::getOpenFileName(TQString::null, i18n("*.png *.jpg *.gif *.xpm|Icon files (*.png, *.jpg, *.gif, *.xpm)\n*.*|All files (*.*)")); if (iconPath.isEmpty()) return; - QImage img; + TQImage img; if (img.load(iconPath)) { double aspectRatio = img.width() / img.height(); - QString message = QString::null; + TQString message = TQString::null; bool too_big, too_wide, too_narrow; too_narrow = aspectRatio < FLAG_ICON_WIDTH / FLAG_ICON_HEIGHT - 0.1; too_wide = aspectRatio > FLAG_ICON_WIDTH / FLAG_ICON_HEIGHT + 0.1; @@ -102,7 +102,7 @@ void KBPickIconDlg::slotBrowseForIcon() "Preferred size for the layout icons is %3 by %4.\n") .arg(img.width()).arg(img.height()).arg(FLAG_ICON_WIDTH).arg(FLAG_ICON_HEIGHT); if (too_big) { - QString msg_tail = ""; + TQString msg_tail = ""; if (too_wide) msg_tail = i18n(" and also too wide"); else if (too_narrow) msg_tail += i18n(" and also too narrow"); message += i18n("This image is too big%1.").arg(msg_tail); @@ -116,9 +116,9 @@ void KBPickIconDlg::slotBrowseForIcon() } if (img.width() > FLAG_ICON_WIDTH + 3 || img.height() > FLAG_ICON_HEIGHT + 3) img = img.smoothScale(FLAG_ICON_WIDTH, FLAG_ICON_HEIGHT); - QPixmap pix; + TQPixmap pix; pix.convertFromImage(img); - PathListBoxItem *item = new PathListBoxItem(lbIcons, pix, QFileInfo(iconPath).fileName(), + PathListBoxItem *item = new PathListBoxItem(lbIcons, pix, TQFileInfo(iconPath).fileName(), iconPath); lbIcons->setSelected(item, true); lbIcons->centerCurrentItem(); @@ -129,16 +129,16 @@ void KBPickIconDlg::slotBrowseForIcon() void KBPickIconDlg::loadCountryFlags() { - QPixmap pix; - QDir dir; - QStringList locales; - QString path; - QStringList dirs = KGlobal::dirs()->findDirs("locale", "l10n"); + TQPixmap pix; + TQDir dir; + TQStringList locales; + TQString path; + TQStringList dirs = KGlobal::dirs()->findDirs("locale", "l10n"); - for (QStringList::Iterator dirIter = dirs.begin(); dirIter != dirs.end(); dirIter++) { + for (TQStringList::Iterator dirIter = dirs.begin(); dirIter != dirs.end(); dirIter++) { dir.setPath(*dirIter); - locales = dir.entryList(QDir::Dirs, QDir::Name); - for (QStringList::Iterator iter = locales.begin(); iter != locales.end(); iter++) { + locales = dir.entryList(TQDir::Dirs, TQDir::Name); + for (TQStringList::Iterator iter = locales.begin(); iter != locales.end(); iter++) { path = dir.path() + "/" + *iter + "/flag.png"; if (*iter != "." && *iter != ".." && pix.load(path)) { KConfig config(dir.path() + "/" + *iter + "/entry.desktop", true, false, @@ -152,16 +152,16 @@ void KBPickIconDlg::loadCountryFlags() void KBPickIconDlg::loadGkbCountryFlags() { - QDir dir; - QString path, code, name; - QPixmap pix; - QImage img; + TQDir dir; + TQString path, code, name; + TQPixmap pix; + TQImage img; dir.setPath("/usr/share/pixmaps/gkb"); - const QFileInfoList *icons = dir.entryInfoList(QDir::Files, QDir::Name); + const TQFileInfoList *icons = dir.entryInfoList(TQDir::Files, TQDir::Name); if (icons) { - QFileInfoListIterator iter(*icons); - QFileInfo *info; + TQFileInfoListIterator iter(*icons); + TQFileInfo *info; for (; (info = iter.current()); ++iter) { path = info->filePath(); code = info->baseName(); @@ -178,8 +178,8 @@ void KBPickIconDlg::loadGkbCountryFlags() } } -void KBPickIconDlg::showCurrentPath(const QString ¤tPath, - const QPixmap ¤tPixmap) +void KBPickIconDlg::showCurrentPath(const TQString ¤tPath, + const TQPixmap ¤tPixmap) { PathListBoxItem *item = NULL; bool itemFound = false; @@ -193,11 +193,11 @@ void KBPickIconDlg::showCurrentPath(const QString ¤tPath, // why this strange manipulation of HScrollBarMode? // Strangely, without it, if the selected item is the last in the listbox, it ends up // being obscured by the horizontal scrollbar - lbIcons->setHScrollBarMode(QScrollView::AlwaysOn); + lbIcons->setHScrollBarMode(TQScrollView::AlwaysOn); if (!itemFound) item = new PathListBoxItem(lbIcons, currentPixmap, - QFileInfo(currentPath).fileName(), currentPath); + TQFileInfo(currentPath).fileName(), currentPath); lbIcons->updateScrollBars(); lbIcons->setSelected(item, true); lbIcons->ensureCurrentVisible(); - lbIcons->setHScrollBarMode(QScrollView::Auto); + lbIcons->setHScrollBarMode(TQScrollView::Auto); } |