diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
commit | 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch) | |
tree | 073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /kopete/plugins/history/historydialog.cpp | |
parent | 3467e6464beac3a162839bf7078e22e3a74d73e7 (diff) | |
download | tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip |
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/history/historydialog.cpp')
-rw-r--r-- | kopete/plugins/history/historydialog.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/kopete/plugins/history/historydialog.cpp b/kopete/plugins/history/historydialog.cpp index 5dc550be..2496f893 100644 --- a/kopete/plugins/history/historydialog.cpp +++ b/kopete/plugins/history/historydialog.cpp @@ -60,7 +60,7 @@ class KListViewDateItem : public KListViewItem { public: - KListViewDateItem(KListView* parent, TQDate date, Kopete::MetaContact *mc); + KListViewDateItem(KListView* tqparent, TQDate date, Kopete::MetaContact *mc); TQDate date() { return mDate; } Kopete::MetaContact *metaContact() { return mMetaContact; } @@ -73,8 +73,8 @@ private: -KListViewDateItem::KListViewDateItem(KListView* parent, TQDate date, Kopete::MetaContact *mc) - : KListViewItem(parent, date.toString(Qt::ISODate), mc->displayName()) +KListViewDateItem::KListViewDateItem(KListView* tqparent, TQDate date, Kopete::MetaContact *mc) + : KListViewItem(tqparent, date.toString(Qt::ISODate), mc->displayName()) { mDate = date; mMetaContact = mc; @@ -93,16 +93,16 @@ int KListViewDateItem::compare(TQListViewItem *i, int col, bool ascending) const } -HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent, - const char* name) : KDialogBase(parent, name, false, - i18n("History for %1").arg(mc->displayName()), 0), mSearching(false) +HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* tqparent, + const char* name) : KDialogBase(tqparent, name, false, + i18n("History for %1").tqarg(mc->displayName()), 0), mSearching(false) { TQString fontSize; TQString htmlCode; TQString fontStyle; kdDebug(14310) << k_funcinfo << "called." << endl; - setWFlags(Qt::WDestructiveClose); // send TQT_SIGNAL(closing()) on quit + setWFlags(TQt::WDestructiveClose); // send TQT_SIGNAL(closing()) on quit // FIXME: Allow to show this dialog for only one contact mMetaContact = mc; @@ -125,7 +125,7 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent, } if (mMetaContact) - mMainWidget->contactComboBox->setCurrentItem(mMetaContactList.find(mMetaContact)+1); + mMainWidget->contactComboBox->setCurrentItem(mMetaContactList.tqfind(mMetaContact)+1); mMainWidget->dateSearchLine->setListView(mMainWidget->dateListView); mMainWidget->dateListView->setSorting(0, 0); //newest-first @@ -147,8 +147,8 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent, mHtmlView = mHtmlPart->view(); mHtmlView->setMarginWidth(4); mHtmlView->setMarginHeight(4); - mHtmlView->setFocusPolicy(NoFocus); - mHtmlView->setSizePolicy( + mHtmlView->setFocusPolicy(TQ_NoFocus); + mHtmlView->tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding)); l->addWidget(mHtmlView); @@ -157,7 +157,7 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent, mHtmlPart->begin(); htmlCode = "<html><head>" + fontStyle + "</head><body class=\"hf\"></body></html>"; - mHtmlPart->write( TQString::fromLatin1( htmlCode.latin1() ) ); + mHtmlPart->write( TQString::tqfromLatin1( htmlCode.latin1() ) ); mHtmlPart->end(); @@ -174,8 +174,8 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent, //initActions KActionCollection* ac = new KActionCollection(this); - mCopyAct = KStdAction::copy( this, TQT_SLOT(slotCopy()), ac ); - mCopyURLAct = new KAction( i18n( "Copy Link Address" ), TQString::fromLatin1( "editcopy" ), 0, this, TQT_SLOT( slotCopyURL() ), ac ); + mCopyAct = KStdAction::copy( TQT_TQOBJECT(this), TQT_SLOT(slotCopy()), ac ); + mCopyURLAct = new KAction( i18n( "Copy Link Address" ), TQString::tqfromLatin1( "editcopy" ), 0, TQT_TQOBJECT(this), TQT_SLOT( slotCopyURL() ), ac ); resize(650, 700); centerOnScreen(this); @@ -196,7 +196,7 @@ void HistoryDialog::init() { if(mMetaContact) { - HistoryLogger logger(mMetaContact, this); + HistoryLogger logger(mMetaContact, TQT_TQOBJECT(this)); init(mMetaContact); } else @@ -204,7 +204,7 @@ void HistoryDialog::init() TQPtrListIterator<Kopete::MetaContact> it(mMetaContactList); for(; it.current(); ++it) { - HistoryLogger logger(*it, this); + HistoryLogger logger(*it, TQT_TQOBJECT(this)); init(*it); } @@ -226,12 +226,12 @@ void HistoryDialog::slotLoadDays() DMPair pair(mInit.dateMCList.first()); mInit.dateMCList.pop_front(); - HistoryLogger logger(pair.metaContact(), this); + HistoryLogger logger(pair.metaContact(), TQT_TQOBJECT(this)); TQValueList<int> dayList = logger.getDaysForMonth(pair.date()); for (unsigned int i=0; i<dayList.count(); i++) { TQDate c2Date(pair.date().year(),pair.date().month(),dayList[i]); - if (mInit.dateMCList.find(pair) == mInit.dateMCList.end()) + if (mInit.dateMCList.tqfind(pair) == mInit.dateMCList.end()) new KListViewDateItem(mMainWidget->dateListView, c2Date, pair.metaContact()); } mMainWidget->searchProgress->advance(1); @@ -255,24 +255,24 @@ void HistoryDialog::init(Kopete::Contact *c) { // Get year and month list TQRegExp rx( "\\.(\\d\\d\\d\\d)(\\d\\d)" ); - const TQString contact_in_filename=c->contactId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ); + const TQString contact_in_filename=c->contactId().tqreplace( TQRegExp( TQString::tqfromLatin1( "[./~?*]" ) ), TQString::tqfromLatin1( "-" ) ); TQFileInfo *fi; // BEGIN check if there are Kopete 0.7.x TQDir d1(locateLocal("data",TQString("kopete/logs/")+ - c->protocol()->pluginId().replace( TQRegExp(TQString::fromLatin1("[./~?*]")),TQString::fromLatin1("-")) + c->protocol()->pluginId().tqreplace( TQRegExp(TQString::tqfromLatin1("[./~?*]")),TQString::tqfromLatin1("-")) )); d1.setFilter( TQDir::Files | TQDir::NoSymLinks ); d1.setSorting( TQDir::Name ); - const QFileInfoList *list1 = d1.entryInfoList(); + const TQFileInfoList *list1 = d1.entryInfoList(); if ( list1 != 0 ) { - QFileInfoListIterator it1( *list1 ); + TQFileInfoListIterator it1( *list1 ); while ( (fi = it1.current()) != 0 ) { - if(fi->fileName().contains(contact_in_filename)) + if(fi->fileName().tqcontains(contact_in_filename)) { rx.search(fi->fileName()); @@ -288,20 +288,20 @@ void HistoryDialog::init(Kopete::Contact *c) // END of kopete 0.7.x check TQString logDir = locateLocal("data",TQString("kopete/logs/")+ - c->protocol()->pluginId().replace( TQRegExp(TQString::fromLatin1("[./~?*]")),TQString::fromLatin1("-")) + - TQString::fromLatin1( "/" ) + - c->account()->accountId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) + c->protocol()->pluginId().tqreplace( TQRegExp(TQString::tqfromLatin1("[./~?*]")),TQString::tqfromLatin1("-")) + + TQString::tqfromLatin1( "/" ) + + c->account()->accountId().tqreplace( TQRegExp( TQString::tqfromLatin1( "[./~?*]" ) ), TQString::tqfromLatin1( "-" ) ) ); TQDir d(logDir); d.setFilter( TQDir::Files | TQDir::NoSymLinks ); d.setSorting( TQDir::Name ); - const QFileInfoList *list = d.entryInfoList(); + const TQFileInfoList *list = d.entryInfoList(); if ( list != 0 ) { - QFileInfoListIterator it( *list ); + TQFileInfoListIterator it( *list ); while ( (fi = it.current()) != 0 ) { - if(fi->fileName().contains(contact_in_filename)) + if(fi->fileName().tqcontains(contact_in_filename)) { rx.search(fi->fileName()); @@ -325,7 +325,7 @@ void HistoryDialog::dateSelected(TQListViewItem* it) TQDate chosenDate = item->date(); - HistoryLogger logger(item->metaContact(), this); + HistoryLogger logger(item->metaContact(), TQT_TQOBJECT(this)); TQValueList<Kopete::Message> msgs=logger.readMessages(chosenDate); setMessages(msgs); @@ -339,16 +339,16 @@ void HistoryDialog::setMessages(TQValueList<Kopete::Message> msgs) htmlBody.removeChild(htmlBody.childNodes().item(htmlBody.childNodes().length() - 1)); // ---- - TQString dir = (TQApplication::reverseLayout() ? TQString::fromLatin1("rtl") : - TQString::fromLatin1("ltr")); + TQString dir = (TQApplication::reverseLayout() ? TQString::tqfromLatin1("rtl") : + TQString::tqfromLatin1("ltr")); TQValueList<Kopete::Message>::iterator it = msgs.begin(); TQString accountLabel; TQString resultHTML = "<b><font color=\"red\">" + (*it).timestamp().date().toString() + "</font></b><br/>"; - DOM::HTMLElement newNode = mHtmlPart->document().createElement(TQString::fromLatin1("span")); - newNode.setAttribute(TQString::fromLatin1("dir"), dir); + DOM::HTMLElement newNode = mHtmlPart->document().createElement(TQString::tqfromLatin1("span")); + newNode.setAttribute(TQString::tqfromLatin1("dir"), dir); newNode.setInnerHTML(resultHTML); mHtmlPart->htmlDocument().body().appendChild(newNode); @@ -375,7 +375,7 @@ void HistoryDialog::setMessages(TQValueList<Kopete::Message> msgs) if (!mMainWidget->searchLine->text().isEmpty()) // If there is a search, then we hightlight the keywords { - body = body.replace(mMainWidget->searchLine->text(), "<span style=\"background-color:yellow\">" + mMainWidget->searchLine->text() + "</span>", false); + body = body.tqreplace(mMainWidget->searchLine->text(), "<span style=\"background-color:yellow\">" + mMainWidget->searchLine->text() + "</span>", false); } resultHTML += "(<b>" + (*it).timestamp().time().toString() + "</b>) " @@ -384,8 +384,8 @@ void HistoryDialog::setMessages(TQValueList<Kopete::Message> msgs) : "<font color=\"" + KopetePrefs::prefs()->textColor().light(200).name() + "\"><b><</b></font> ") + body + "<br/>"; - newNode = mHtmlPart->document().createElement(TQString::fromLatin1("span")); - newNode.setAttribute(TQString::fromLatin1("dir"), dir); + newNode = mHtmlPart->document().createElement(TQString::tqfromLatin1("span")); + newNode.setAttribute(TQString::tqfromLatin1("dir"), dir); newNode.setInnerHTML(resultHTML); mHtmlPart->htmlDocument().body().appendChild(newNode); @@ -477,12 +477,12 @@ void HistoryDialog::slotSearch() curItem = static_cast<KListViewDateItem *>(curItem->nextSibling()) ) { - qApp->processEvents(); + tqApp->processEvents(); if (!mSearching) return; TQDate month(curItem->date().year(),curItem->date().month(),1); // if we haven't searched the relevant history logs, search them now - if (!monthsSearched[month].contains(curItem->metaContact())) + if (!monthsSearched[month].tqcontains(curItem->metaContact())) { monthsSearched[month].push_back(curItem->metaContact()); TQPtrList<Kopete::Contact> contacts = curItem->metaContact()->contacts(); @@ -496,7 +496,7 @@ void HistoryDialog::slotSearch() if (!file.isOpen()) { kdWarning(14310) << k_funcinfo << "Error opening " << - file.name() << ": " << file.errorString() << endl; + file.name() << ": " << file.errorString().data() << endl; continue; } @@ -505,19 +505,19 @@ void HistoryDialog::slotSearch() while(!stream.atEnd()) { textLine = stream.readLine(); - if (textLine.contains(mMainWidget->searchLine->text(), false)) + if (textLine.tqcontains(mMainWidget->searchLine->text(), false)) { if(rx.search(textLine) != -1) { // only match message body - if (rx.cap(2).contains(mMainWidget->searchLine->text())) + if (rx.cap(2).tqcontains(mMainWidget->searchLine->text())) matches[TQDate(curItem->date().year(),curItem->date().month(),rx.cap(1).toInt())].push_back(curItem->metaContact()); } // this will happen when multiline messages are searched, properly // parsing the files would fix this else { } } - qApp->processEvents(); + tqApp->processEvents(); if (!mSearching) return; } file.close(); @@ -525,7 +525,7 @@ void HistoryDialog::slotSearch() } // relevant logfiles have been searched now, check if current date matches - if (matches[curItem->date()].contains(curItem->metaContact())) + if (matches[curItem->date()].tqcontains(curItem->metaContact())) curItem->setVisible(true); // Next date item @@ -553,7 +553,7 @@ void HistoryDialog::slotContactChanged(int index) else { mMetaContact = mMetaContactList.at(index-1); - setCaption(i18n("History for %1").arg(mMetaContact->displayName())); + setCaption(i18n("History for %1").tqarg(mMetaContact->displayName())); init(); } } @@ -597,16 +597,16 @@ void HistoryDialog::slotCopy() if ( qsSelection.isEmpty() ) return; disconnect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); - TQApplication::clipboard()->setText(qsSelection, QClipboard::Clipboard); - TQApplication::clipboard()->setText(qsSelection, QClipboard::Selection); + TQApplication::tqclipboard()->setText(qsSelection, TQClipboard::Clipboard); + TQApplication::tqclipboard()->setText(qsSelection, TQClipboard::Selection); connect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); } void HistoryDialog::slotCopyURL() { disconnect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); - TQApplication::clipboard()->setText( mURL, QClipboard::Clipboard); - TQApplication::clipboard()->setText( mURL, QClipboard::Selection); + TQApplication::tqclipboard()->setText( mURL, TQClipboard::Clipboard); + TQApplication::tqclipboard()->setText( mURL, TQClipboard::Selection); connect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); } |