diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
commit | fecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch) | |
tree | 6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/widgets/klistviewsearchline.cpp | |
parent | dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff) | |
download | kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.tar.gz kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.zip |
TQt4 port kmymoney
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/widgets/klistviewsearchline.cpp')
-rw-r--r-- | kmymoney2/widgets/klistviewsearchline.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/kmymoney2/widgets/klistviewsearchline.cpp b/kmymoney2/widgets/klistviewsearchline.cpp index 5aba160..cd27928 100644 --- a/kmymoney2/widgets/klistviewsearchline.cpp +++ b/kmymoney2/widgets/klistviewsearchline.cpp @@ -25,11 +25,11 @@ #include <kdebug.h> #include <klocale.h> -#include <qapplication.h> -#include <qtimer.h> -#include <qpopupmenu.h> -#include <qlabel.h> -#include <qheader.h> +#include <tqapplication.h> +#include <tqtimer.h> +#include <tqpopupmenu.h> +#include <tqlabel.h> +#include <tqheader.h> #define KLISTVIEWSEARCHLINE_ALLVISIBLECOLUMNS_ID 2004 @@ -47,47 +47,47 @@ public: bool caseSensitive; bool activeSearch; bool keepParentsVisible; - QString search; + TQString search; int queuedSearches; - QValueList<int> searchColumns; + TQValueList<int> searchColumns; }; //////////////////////////////////////////////////////////////////////////////// // public methods //////////////////////////////////////////////////////////////////////////////// -KListViewSearchLine::KListViewSearchLine(QWidget *parent, KListView *listView, const char *name) : - KLineEdit(parent, name) +KListViewSearchLine::KListViewSearchLine(TQWidget *tqparent, KListView *listView, const char *name) : + KLineEdit(tqparent, name) { d = new KListViewSearchLinePrivate; d->listView = listView; - connect(this, SIGNAL(textChanged(const QString &)), - this, SLOT(queueSearch(const QString &))); + connect(this, TQT_SIGNAL(textChanged(const TQString &)), + this, TQT_SLOT(queueSearch(const TQString &))); if(listView) { - connect(listView, SIGNAL(destroyed()), - this, SLOT(listViewDeleted())); + connect(listView, TQT_SIGNAL(destroyed()), + this, TQT_SLOT(listViewDeleted())); #if KDE_IS_VERSION(3,3,0) - connect(listView, SIGNAL(itemAdded(QListViewItem *)), - this, SLOT(itemAdded(QListViewItem *))); + connect(listView, TQT_SIGNAL(itemAdded(TQListViewItem *)), + this, TQT_SLOT(itemAdded(TQListViewItem *))); #endif } else setEnabled(false); } -KListViewSearchLine::KListViewSearchLine(QWidget *parent, const char *name) : - KLineEdit(parent, name) +KListViewSearchLine::KListViewSearchLine(TQWidget *tqparent, const char *name) : + KLineEdit(tqparent, name) { d = new KListViewSearchLinePrivate; d->listView = 0; - connect(this, SIGNAL(textChanged(const QString &)), - this, SLOT(queueSearch(const QString &))); + connect(this, TQT_SIGNAL(textChanged(const TQString &)), + this, TQT_SLOT(queueSearch(const TQString &))); setEnabled(false); } @@ -102,7 +102,7 @@ bool KListViewSearchLine::caseSensitive() const return d->caseSensitive; } -QValueList<int> KListViewSearchLine::searchColumns() const +TQValueList<int> KListViewSearchLine::searchColumns() const { return d->searchColumns; } @@ -121,7 +121,7 @@ KListView *KListViewSearchLine::listView() const // public slots //////////////////////////////////////////////////////////////////////////////// -void KListViewSearchLine::updateSearch(const QString &s) +void KListViewSearchLine::updateSearch(const TQString &s) { if(!d->listView) return; @@ -131,7 +131,7 @@ void KListViewSearchLine::updateSearch(const QString &s) // If there's a selected item that is visible, make sure that it's visible // when the search changes too (assuming that it still matches). - QListViewItem *currentItem = 0; + TQListViewItem *currentItem = 0; switch(d->listView->selectionMode()) { @@ -142,12 +142,12 @@ void KListViewSearchLine::updateSearch(const QString &s) break; default: { - int flags = QListViewItemIterator::Selected | QListViewItemIterator::Visible; - for(QListViewItemIterator it(d->listView, flags); + int flags = TQListViewItemIterator::Selected | TQListViewItemIterator::Visible; + for(TQListViewItemIterator it(d->listView, flags); it.current() && !currentItem; ++it) { - if(d->listView->itemRect(it.current()).isValid()) + if(d->listView->tqitemRect(it.current()).isValid()) currentItem = it.current(); } } @@ -172,7 +172,7 @@ void KListViewSearchLine::setKeepParentsVisible(bool v) d->keepParentsVisible = v; } -void KListViewSearchLine::setSearchColumns(const QValueList<int> &columns) +void KListViewSearchLine::setSearchColumns(const TQValueList<int> &columns) { d->searchColumns = columns; } @@ -180,24 +180,24 @@ void KListViewSearchLine::setSearchColumns(const QValueList<int> &columns) void KListViewSearchLine::setListView(KListView *lv) { if(d->listView) { - disconnect(d->listView, SIGNAL(destroyed()), - this, SLOT(listViewDeleted())); + disconnect(d->listView, TQT_SIGNAL(destroyed()), + this, TQT_SLOT(listViewDeleted())); #if KDE_IS_VERSION(3,3,0) - disconnect(d->listView, SIGNAL(itemAdded(QListViewItem *)), - this, SLOT(itemAdded(QListViewItem *))); + disconnect(d->listView, TQT_SIGNAL(itemAdded(TQListViewItem *)), + this, TQT_SLOT(itemAdded(TQListViewItem *))); #endif } d->listView = lv; if(lv) { - connect(d->listView, SIGNAL(destroyed()), - this, SLOT(listViewDeleted())); + connect(d->listView, TQT_SIGNAL(destroyed()), + this, TQT_SLOT(listViewDeleted())); #if KDE_IS_VERSION(3,3,0) - connect(d->listView, SIGNAL(itemAdded(QListViewItem *)), - this, SLOT(itemAdded(QListViewItem *))); + connect(d->listView, TQT_SIGNAL(itemAdded(TQListViewItem *)), + this, TQT_SLOT(itemAdded(TQListViewItem *))); #endif } @@ -208,7 +208,7 @@ void KListViewSearchLine::setListView(KListView *lv) // protected members //////////////////////////////////////////////////////////////////////////////// -bool KListViewSearchLine::itemMatches(const QListViewItem *item, const QString &s) const +bool KListViewSearchLine::itemMatches(const TQListViewItem *item, const TQString &s) const { if(s.isEmpty()) return true; @@ -217,17 +217,17 @@ bool KListViewSearchLine::itemMatches(const QListViewItem *item, const QString & // specifified. If it is empty default to searching all of the columns. if(!d->searchColumns.isEmpty()) { - QValueList<int>::ConstIterator it = d->searchColumns.begin(); + TQValueList<int>::ConstIterator it = d->searchColumns.begin(); for(; it != d->searchColumns.end(); ++it) { if(*it < item->listView()->columns() && - item->text(*it).find(s, 0, d->caseSensitive) >= 0) + item->text(*it).tqfind(s, 0, d->caseSensitive) >= 0) return true; } } else { for(int i = 0; i < item->listView()->columns(); i++) { if(item->listView()->columnWidth(i) > 0 && - item->text(i).find(s, 0, d->caseSensitive) >= 0) + item->text(i).tqfind(s, 0, d->caseSensitive) >= 0) { return true; } @@ -237,13 +237,13 @@ bool KListViewSearchLine::itemMatches(const QListViewItem *item, const QString & return false; } -QPopupMenu *KListViewSearchLine::createPopupMenu() +TQPopupMenu *KListViewSearchLine::createPopupMenu() { - QPopupMenu *popup = KLineEdit::createPopupMenu(); + TQPopupMenu *popup = KLineEdit::createPopupMenu(); if (d->listView->columns()>1) { - QPopupMenu *subMenu = new QPopupMenu(popup); - connect(subMenu, SIGNAL(activated(int)), this, SLOT(searchColumnsMenuActivated(int))); + TQPopupMenu *subMenu = new TQPopupMenu(popup); + connect(subMenu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(searchColumnsMenuActivated(int))); popup->insertSeparator(); popup->insertItem(i18n("Search Columns"), subMenu); @@ -253,20 +253,20 @@ QPopupMenu *KListViewSearchLine::createPopupMenu() bool allColumnsAreSearchColumns = true; // TODO Make the entry order match the actual column order - QHeader* const header = d->listView->header(); + TQHeader* const header = d->listView->header(); int visibleColumns = 0; for(int i = 0; i < d->listView->columns(); i++) { if(d->listView->columnWidth(i)>0) { - QString columnText = d->listView->columnText(i); + TQString columnText = d->listView->columnText(i); if(columnText.isEmpty()) { int visiblePosition=1; for(int j = 0; j < header->mapToIndex(i); j++) if(d->listView->columnWidth(header->mapToSection(j))>0) visiblePosition++; - columnText = i18n("Column number %1","Column No. %1").arg(visiblePosition); + columnText = i18n("Column number %1","Column No. %1").tqarg(visiblePosition); } subMenu->insertItem(columnText, visibleColumns); - if(d->searchColumns.isEmpty() || d->searchColumns.find(i) != d->searchColumns.end()) + if(d->searchColumns.isEmpty() || d->searchColumns.tqfind(i) != d->searchColumns.end()) subMenu->setItemChecked(visibleColumns, true); else allColumnsAreSearchColumns = false; @@ -287,11 +287,11 @@ QPopupMenu *KListViewSearchLine::createPopupMenu() // protected slots //////////////////////////////////////////////////////////////////////////////// -void KListViewSearchLine::queueSearch(const QString &search) +void KListViewSearchLine::queueSearch(const TQString &search) { d->queuedSearches++; d->search = search; - QTimer::singleShot(200, this, SLOT(activateSearch())); + TQTimer::singleShot(200, this, TQT_SLOT(activateSearch())); } void KListViewSearchLine::activateSearch() @@ -306,7 +306,7 @@ void KListViewSearchLine::activateSearch() // private slots //////////////////////////////////////////////////////////////////////////////// -void KListViewSearchLine::itemAdded(QListViewItem *item) const +void KListViewSearchLine::itemAdded(TQListViewItem *item) const { item->setVisible(itemMatches(item, text())); } @@ -326,7 +326,7 @@ void KListViewSearchLine::searchColumnsMenuActivated(int id) d->searchColumns.clear(); } else { - if(d->searchColumns.find(id) != d->searchColumns.end()) + if(d->searchColumns.tqfind(id) != d->searchColumns.end()) d->searchColumns.remove(id); else { if(d->searchColumns.isEmpty()) { @@ -348,10 +348,10 @@ void KListViewSearchLine::searchColumnsMenuActivated(int id) void KListViewSearchLine::checkItemParentsNotVisible() { - QListViewItemIterator it(d->listView); + TQListViewItemIterator it(d->listView); for(; it.current(); ++it) { - QListViewItem *item = it.current(); + TQListViewItem *item = it.current(); if(itemMatches(item, d->search)) item->setVisible(true); else @@ -365,23 +365,23 @@ void KListViewSearchLine::checkItemParentsNotVisible() * * \p item The list view item to start showing / hiding items at. Typically, this is the first child of another item, or the * the first child of the list view. - * \p highestHiddenParent The highest (closest to root) ancestor of \p item which is hidden. If 0, all parents of + * \p highestHiddenParent The highest (closest to root) ancestor of \p item which is hidden. If 0, all tqparents of * \p item must be visible. * \return \c true if an item which should be visible is found, \c false if all items found should be hidden. If this function * returns true and \p highestHiddenParent was not 0, highestHiddenParent will have been shown. */ -bool KListViewSearchLine::checkItemParentsVisible(QListViewItem *item, QListViewItem *highestHiddenParent) +bool KListViewSearchLine::checkItemParentsVisible(TQListViewItem *item, TQListViewItem *highestHiddenParent) { bool visible = false; - QListViewItem * first = item; + TQListViewItem * first = item; for(; item; item = item->nextSibling()) { - //What we pass to our children as highestHiddenParent: - QListViewItem * hhp = highestHiddenParent ? highestHiddenParent : item->isVisible() ? 0L : item; + //What we pass to our tqchildren as highestHiddenParent: + TQListViewItem * hhp = highestHiddenParent ? highestHiddenParent : item->isVisible() ? 0L : item; bool childMatch = false; if(item->firstChild() && checkItemParentsVisible(item->firstChild(), hhp)) childMatch = true; - // Should this item be shown? It should if any children should be, or if it matches. + // Should this item be shown? It should if any tqchildren should be, or if it matches. if(childMatch || itemMatches(item, d->search)) { visible = true; @@ -390,13 +390,13 @@ bool KListViewSearchLine::checkItemParentsVisible(QListViewItem *item, QListView highestHiddenParent->setVisible(true); // Calling setVisible on our ancestor will unhide all its descendents. Hide the ones // before us that should not be shown. - for(QListViewItem *hide = first; hide != item; hide = hide->nextSibling()) + for(TQListViewItem *hide = first; hide != item; hide = hide->nextSibling()) hide->setVisible(false); highestHiddenParent = 0; - // If we matched, than none of our children matched, yet the setVisible() call on our + // If we matched, than none of our tqchildren matched, yet the setVisible() call on our // ancestor unhid them, undo the damage: if(!childMatch) - for(QListViewItem *hide = item->firstChild(); hide; hide = hide->nextSibling()) + for(TQListViewItem *hide = item->firstChild(); hide; hide = hide->nextSibling()) hide->setVisible(false); } else @@ -418,20 +418,20 @@ public: KListViewSearchLineWidgetPrivate() : listView(0), searchLine(0), clearButton(0) {} KListView *listView; KListViewSearchLine *searchLine; - QToolButton *clearButton; + TQToolButton *clearButton; }; KListViewSearchLineWidget::KListViewSearchLineWidget(KListView *listView, - QWidget *parent, + TQWidget *tqparent, const char *name) : - QHBox(parent, name) + TQHBox(tqparent, name) { d = new KListViewSearchLineWidgetPrivate; d->listView = listView; setSpacing(5); - QTimer::singleShot(0, this, SLOT(createWidgets())); + TQTimer::singleShot(0, this, TQT_SLOT(createWidgets())); } KListViewSearchLineWidget::~KListViewSearchLineWidget() @@ -451,14 +451,14 @@ void KListViewSearchLineWidget::createWidgets() positionInToolBar(); if(!d->clearButton) { - d->clearButton = new QToolButton(this); - QIconSet icon = SmallIconSet(QApplication::reverseLayout() ? "clear_left" : "locationbar_erase"); + d->clearButton = new TQToolButton(this); + TQIconSet icon = SmallIconSet(TQApplication::reverseLayout() ? "clear_left" : "locationbar_erase"); d->clearButton->setIconSet(icon); } d->clearButton->show(); - QLabel *label = new QLabel(i18n("S&earch:"), this, "kde toolbar widget"); + TQLabel *label = new TQLabel(i18n("S&earch:"), this, "kde toolbar widget"); d->searchLine = createSearchLine(d->listView); d->searchLine->show(); @@ -466,7 +466,7 @@ void KListViewSearchLineWidget::createWidgets() label->setBuddy(d->searchLine); label->show(); - connect(d->clearButton, SIGNAL(clicked()), d->searchLine, SLOT(clear())); + connect(d->clearButton, TQT_SIGNAL(clicked()), d->searchLine, TQT_SLOT(clear())); } KListViewSearchLine *KListViewSearchLineWidget::searchLine() const @@ -476,7 +476,7 @@ KListViewSearchLine *KListViewSearchLineWidget::searchLine() const void KListViewSearchLineWidget::positionInToolBar() { - KToolBar *toolBar = dynamic_cast<KToolBar *>(parent()); + KToolBar *toolBar = dynamic_cast<KToolBar *>(tqparent()); if(toolBar) { @@ -491,7 +491,7 @@ void KListViewSearchLineWidget::positionInToolBar() if(toolBar->getWidget(id) == this) { toolBar->setItemAutoSized(id); if(!d->clearButton) { - QString icon = QApplication::reverseLayout() ? "clear_left" : "locationbar_erase"; + TQString icon = TQApplication::reverseLayout() ? "clear_left" : "locationbar_erase"; d->clearButton = new KToolBarButton(icon, 2005, toolBar); } toolBar->insertWidget(2005, d->clearButton->width(), d->clearButton, index); |