diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
commit | 2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch) | |
tree | 18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/groupview.cpp | |
parent | 1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff) | |
download | tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip |
TQt4 port tellico
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/groupview.cpp')
-rw-r--r-- | src/groupview.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/groupview.cpp b/src/groupview.cpp index 67b1a40..16bf8e1 100644 --- a/src/groupview.cpp +++ b/src/groupview.cpp @@ -31,34 +31,34 @@ #include <kiconloader.h> #include <kaction.h> -#include <qstringlist.h> -#include <qcolor.h> -#include <qregexp.h> -#include <qheader.h> +#include <tqstringlist.h> +#include <tqcolor.h> +#include <tqregexp.h> +#include <tqheader.h> using Tellico::GroupView; -GroupView::GroupView(QWidget* parent_, const char* name_/*=0*/) - : GUI::ListView(parent_, name_), m_notSortedYet(true), m_coll(0) { - addColumn(QString::null); // header text gets updated later +GroupView::GroupView(TQWidget* tqparent_, const char* name_/*=0*/) + : GUI::ListView(tqparent_, name_), m_notSortedYet(true), m_coll(0) { + addColumn(TQString()); // header text gets updated later header()->setStretchEnabled(true, 0); - setResizeMode(QListView::NoColumn); + setResizeMode(TQListView::NoColumn); setRootIsDecorated(true); setShowSortIndicator(true); setTreeStepSize(15); setFullWidth(true); - connect(this, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)), - SLOT(contextMenuRequested(QListViewItem*, const QPoint&, int))); + connect(this, TQT_SIGNAL(contextMenuRequested(TQListViewItem*, const TQPoint&, int)), + TQT_SLOT(contextMenuRequested(TQListViewItem*, const TQPoint&, int))); - connect(this, SIGNAL(expanded(QListViewItem*)), - SLOT(slotExpanded(QListViewItem*))); + connect(this, TQT_SIGNAL(expanded(TQListViewItem*)), + TQT_SLOT(slotExpanded(TQListViewItem*))); - connect(this, SIGNAL(collapsed(QListViewItem*)), - SLOT(slotCollapsed(QListViewItem*))); + connect(this, TQT_SIGNAL(collapsed(TQListViewItem*)), + TQT_SLOT(slotCollapsed(TQListViewItem*))); - m_groupOpenPixmap = SmallIcon(QString::fromLatin1("folder_open")); - m_groupClosedPixmap = SmallIcon(QString::fromLatin1("folder")); + m_groupOpenPixmap = SmallIcon(TQString::tqfromLatin1("folder_open")); + m_groupClosedPixmap = SmallIcon(TQString::tqfromLatin1("folder")); } Tellico::EntryGroupItem* GroupView::addGroup(Data::EntryGroup* group_) { @@ -71,7 +71,7 @@ Tellico::EntryGroupItem* GroupView::addGroup(Data::EntryGroup* group_) { } EntryGroupItem* item = new EntryGroupItem(this, group_, type); if(group_->groupName() == i18n(Data::Collection::s_emptyGroupTitle)) { - item->setPixmap(0, SmallIcon(QString::fromLatin1("folder_red"))); + item->setPixmap(0, SmallIcon(TQString::tqfromLatin1("folder_red"))); item->setSortWeight(10); } else { item->setPixmap(0, m_groupClosedPixmap); @@ -115,7 +115,7 @@ void GroupView::slotModifyGroups(Data::CollPtr coll_, PtrVector<Data::EntryGroup } // myDebug() << "GroupView::slotModifyGroups() - " << group->fieldName() << "/" << group->groupName() << endl; - EntryGroupItem* par = m_groupDict.find(group->groupName()); + EntryGroupItem* par = m_groupDict.tqfind(group->groupName()); if(par) { if(group->isEmpty()) { m_groupDict.remove(par->text(0)); @@ -144,7 +144,7 @@ void GroupView::slotModifyGroups(Data::CollPtr coll_, PtrVector<Data::EntryGroup sort(); // in case the count changed, or group name } -// don't 'shadow' QListView::setSelected +// don't 'shadow' TQListView::setSelected void GroupView::setEntrySelected(Data::EntryPtr entry_) { // myDebug() << "GroupView::slotSetSelected()" << endl; // if entry_ is null pointer, set no selected @@ -178,13 +178,13 @@ void GroupView::setEntrySelected(Data::EntryPtr entry_) { return; } - EntryGroupItem* groupItem = m_groupDict.find(group->groupName()); + EntryGroupItem* groupItem = m_groupDict.tqfind(group->groupName()); if(!groupItem) { return; } clearSelection(); - for(QListViewItem* item = groupItem->firstChild(); item; item = item->nextSibling()) { + for(TQListViewItem* item = groupItem->firstChild(); item; item = item->nextSibling()) { EntryItem* entryItem = static_cast<EntryItem*>(item); if(entryItem->entry() == entry_) { blockSignals(true); @@ -212,7 +212,7 @@ void GroupView::slotCollapseAll(int depth_/*=-1*/) { } void GroupView::setSiblingsOpen(int depth_, bool open_) { - QListViewItem* item = 0; + TQListViewItem* item = 0; if(depth_ == -1) { item = currentItem(); @@ -240,7 +240,7 @@ void GroupView::setSiblingsOpen(int depth_, bool open_) { } } -void GroupView::contextMenuRequested(QListViewItem* item_, const QPoint& point_, int) { +void GroupView::contextMenuRequested(TQListViewItem* item_, const TQPoint& point_, int) { if(!item_) { return; } @@ -248,23 +248,23 @@ void GroupView::contextMenuRequested(QListViewItem* item_, const QPoint& point_, KPopupMenu menu(this); GUI::ListViewItem* item = static_cast<GUI::ListViewItem*>(item_); if(item->isEntryGroupItem()) { - menu.insertItem(SmallIconSet(QString::fromLatin1("2downarrow")), - i18n("Expand All Groups"), this, SLOT(slotExpandAll())); - menu.insertItem(SmallIconSet(QString::fromLatin1("2uparrow")), - i18n("Collapse All Groups"), this, SLOT(slotCollapseAll())); - menu.insertItem(SmallIconSet(QString::fromLatin1("filter")), - i18n("Filter by Group"), this, SLOT(slotFilterGroup())); + menu.insertItem(SmallIconSet(TQString::tqfromLatin1("2downarrow")), + i18n("Expand All Groups"), this, TQT_SLOT(slotExpandAll())); + menu.insertItem(SmallIconSet(TQString::tqfromLatin1("2uparrow")), + i18n("Collapse All Groups"), this, TQT_SLOT(slotCollapseAll())); + menu.insertItem(SmallIconSet(TQString::tqfromLatin1("filter")), + i18n("Filter by Group"), this, TQT_SLOT(slotFilterGroup())); } else if(item->isEntryItem()) { Controller::self()->plugEntryActions(&menu); } menu.exec(point_); } -void GroupView::slotCollapsed(QListViewItem* item_) { +void GroupView::slotCollapsed(TQListViewItem* item_) { // only change icon for group items if(static_cast<GUI::ListViewItem*>(item_)->isEntryGroupItem()) { if(item_->text(0) == i18n(Data::Collection::s_emptyGroupTitle)) { - item_->setPixmap(0, SmallIcon(QString::fromLatin1("folder_red"))); + item_->setPixmap(0, SmallIcon(TQString::tqfromLatin1("folder_red"))); } else { item_->setPixmap(0, m_groupClosedPixmap); } @@ -272,7 +272,7 @@ void GroupView::slotCollapsed(QListViewItem* item_) { } } -void GroupView::slotExpanded(QListViewItem* item_) { +void GroupView::slotExpanded(TQListViewItem* item_) { EntryGroupItem* item = static_cast<EntryGroupItem*>(item_); // only change icon for group items if(!item->isEntryGroupItem()) { @@ -281,7 +281,7 @@ void GroupView::slotExpanded(QListViewItem* item_) { setUpdatesEnabled(false); if(item->text(0) == i18n(Data::Collection::s_emptyGroupTitle)) { - item->setPixmap(0, SmallIcon(QString::fromLatin1("folder_red_open"))); + item->setPixmap(0, SmallIcon(TQString::tqfromLatin1("folder_red_open"))); } else { item->setPixmap(0, m_groupOpenPixmap); } @@ -316,11 +316,11 @@ void GroupView::addCollection(Data::CollPtr coll_) { // when the coll gets set for the first time, the pixmaps need to be updated if((m_coll->hasField(m_groupBy) && m_coll->fieldByName(m_groupBy)->formatFlag() == Data::Field::FormatName) || m_groupBy == Data::Collection::s_peopleGroupName) { - m_groupOpenPixmap = UserIcon(QString::fromLatin1("person-open")); - m_groupClosedPixmap = UserIcon(QString::fromLatin1("person")); + m_groupOpenPixmap = UserIcon(TQString::tqfromLatin1("person-open")); + m_groupClosedPixmap = UserIcon(TQString::tqfromLatin1("person")); } - Data::FieldPtr f = coll_->fieldByName(QString::fromLatin1("title")); + Data::FieldPtr f = coll_->fieldByName(TQString::tqfromLatin1("title")); if(f) { setComparison(0, ListViewComparison::create(f)); } @@ -332,7 +332,7 @@ void GroupView::addCollection(Data::CollPtr coll_) { // myDebug() << "GroupView::addCollection - done" << endl; } -void GroupView::setGroupField(const QString& groupField_) { +void GroupView::setGroupField(const TQString& groupField_) { // myDebug() << "GroupView::setGroupField - " << groupField_ << endl; if(groupField_.isEmpty() || groupField_ == m_groupBy) { return; @@ -344,11 +344,11 @@ void GroupView::setGroupField(const QString& groupField_) { } if((m_coll->hasField(groupField_) && m_coll->fieldByName(groupField_)->formatFlag() == Data::Field::FormatName) || groupField_ == Data::Collection::s_peopleGroupName) { - m_groupOpenPixmap = UserIcon(QString::fromLatin1("person-open")); - m_groupClosedPixmap = UserIcon(QString::fromLatin1("person")); + m_groupOpenPixmap = UserIcon(TQString::tqfromLatin1("person-open")); + m_groupClosedPixmap = UserIcon(TQString::tqfromLatin1("person")); } else { - m_groupOpenPixmap = SmallIcon(QString::fromLatin1("folder_open")); - m_groupClosedPixmap = SmallIcon(QString::fromLatin1("folder")); + m_groupOpenPixmap = SmallIcon(TQString::tqfromLatin1("folder_open")); + m_groupClosedPixmap = SmallIcon(TQString::tqfromLatin1("folder")); } updateHeader(); populateCollection(); @@ -381,7 +381,7 @@ void GroupView::populateCollection() { // iterate over all the groups in the dict // e.g. if the dict is "author", loop over all the author groups - for(QDictIterator<Data::EntryGroup> it(*dict); it.current(); ++it) { + for(TQDictIterator<Data::EntryGroup> it(*dict); it.current(); ++it) { addGroup(it.current()); } @@ -411,7 +411,7 @@ void GroupView::slotFilterGroup() { filter->append(new FilterRule(fIt->name(), it.current()->text(0), FilterRule::FuncContains)); } } else { - QString s = it.current()->text(0); + TQString s = it.current()->text(0); if(s != i18n(Data::Collection::s_emptyGroupTitle)) { filter->append(new FilterRule(m_groupBy, it.current()->text(0), FilterRule::FuncContains)); } @@ -459,16 +459,16 @@ void GroupView::removeField(Data::CollPtr, Data::FieldPtr) { } void GroupView::updateHeader(Data::FieldPtr field_/*=0*/) { - QString t = field_ ? field_->title() : groupTitle(); + TQString t = field_ ? field_->title() : groupTitle(); if(sortStyle() == ListView::SortByText) { setColumnText(0, t); } else { - setColumnText(0, i18n("%1 (Sort by Count)").arg(t)); + setColumnText(0, i18n("%1 (Sort by Count)").tqarg(t)); } } -QString GroupView::groupTitle() { - QString title; +TQString GroupView::groupTitle() { + TQString title; if(!m_coll || m_groupBy.isEmpty()) { title = i18n("Group Name Header", "Group"); } else { @@ -486,7 +486,7 @@ void GroupView::resetComparisons() { if(!m_coll) { return; } - Data::FieldPtr f = m_coll->fieldByName(QString::fromLatin1("title")); + Data::FieldPtr f = m_coll->fieldByName(TQString::tqfromLatin1("title")); if(f) { setComparison(0, ListViewComparison::create(f)); } |