From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/plugins/history/historydialog.cpp | 208 +++++++++++++++---------------- 1 file changed, 104 insertions(+), 104 deletions(-) (limited to 'kopete/plugins/history/historydialog.cpp') diff --git a/kopete/plugins/history/historydialog.cpp b/kopete/plugins/history/historydialog.cpp index 4dd98fee..5dc550be 100644 --- a/kopete/plugins/history/historydialog.cpp +++ b/kopete/plugins/history/historydialog.cpp @@ -32,15 +32,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -60,30 +60,30 @@ class KListViewDateItem : public KListViewItem { public: - KListViewDateItem(KListView* parent, QDate date, Kopete::MetaContact *mc); - QDate date() { return mDate; } + KListViewDateItem(KListView* parent, TQDate date, Kopete::MetaContact *mc); + TQDate date() { return mDate; } Kopete::MetaContact *metaContact() { return mMetaContact; } public: - int compare(QListViewItem *i, int col, bool ascending) const; + int compare(TQListViewItem *i, int col, bool ascending) const; private: - QDate mDate; + TQDate mDate; Kopete::MetaContact *mMetaContact; }; -KListViewDateItem::KListViewDateItem(KListView* parent, QDate date, Kopete::MetaContact *mc) +KListViewDateItem::KListViewDateItem(KListView* parent, TQDate date, Kopete::MetaContact *mc) : KListViewItem(parent, date.toString(Qt::ISODate), mc->displayName()) { mDate = date; mMetaContact = mc; } -int KListViewDateItem::compare(QListViewItem *i, int col, bool ascending) const +int KListViewDateItem::compare(TQListViewItem *i, int col, bool ascending) const { if (col) - return QListViewItem::compare(i, col, ascending); + return TQListViewItem::compare(i, col, ascending); //compare dates - do NOT use ascending var here KListViewDateItem* item = static_cast(i); @@ -93,16 +93,16 @@ int KListViewDateItem::compare(QListViewItem *i, int col, bool ascending) const } -HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, +HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent, const char* name) : KDialogBase(parent, name, false, i18n("History for %1").arg(mc->displayName()), 0), mSearching(false) { - QString fontSize; - QString htmlCode; - QString fontStyle; + TQString fontSize; + TQString htmlCode; + TQString fontStyle; kdDebug(14310) << k_funcinfo << "called." << endl; - setWFlags(Qt::WDestructiveClose); // send SIGNAL(closing()) on quit + setWFlags(Qt::WDestructiveClose); // send TQT_SIGNAL(closing()) on quit // FIXME: Allow to show this dialog for only one contact mMetaContact = mc; @@ -118,7 +118,7 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, mMainWidget->contactComboBox->insertItem(i18n("All")); mMetaContactList = Kopete::ContactList::self()->metaContacts(); - QPtrListIterator it(mMetaContactList); + TQPtrListIterator it(mMetaContactList); for(; it.current(); ++it) { mMainWidget->contactComboBox->insertItem((*it)->displayName()); @@ -133,8 +133,8 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, setMainWidget(mMainWidget); // Initializing HTML Part - mMainWidget->htmlFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - QVBoxLayout *l = new QVBoxLayout(mMainWidget->htmlFrame); + mMainWidget->htmlFrame->setFrameStyle(TQFrame::WinPanel | TQFrame::Sunken); + TQVBoxLayout *l = new TQVBoxLayout(mMainWidget->htmlFrame); mHtmlPart = new KHTMLPart(mMainWidget->htmlFrame, "htmlHistoryView"); //Security settings, we don't need this stuff @@ -149,33 +149,33 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, mHtmlView->setMarginHeight(4); mHtmlView->setFocusPolicy(NoFocus); mHtmlView->setSizePolicy( - QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding)); l->addWidget(mHtmlView); - QTextOStream( &fontSize ) << KopetePrefs::prefs()->fontFace().pointSize(); + TQTextOStream( &fontSize ) << KopetePrefs::prefs()->fontFace().pointSize(); fontStyle = ""; mHtmlPart->begin(); htmlCode = "" + fontStyle + ""; - mHtmlPart->write( QString::fromLatin1( htmlCode.latin1() ) ); + mHtmlPart->write( TQString::fromLatin1( htmlCode.latin1() ) ); mHtmlPart->end(); - connect(mHtmlPart->browserExtension(), SIGNAL(openURLRequestDelayed(const KURL &, const KParts::URLArgs &)), - this, SLOT(slotOpenURLRequest(const KURL &, const KParts::URLArgs &))); - connect(mMainWidget->dateListView, SIGNAL(clicked(QListViewItem*)), this, SLOT(dateSelected(QListViewItem*))); - connect(mMainWidget->searchButton, SIGNAL(clicked()), this, SLOT(slotSearch())); - connect(mMainWidget->searchLine, SIGNAL(returnPressed()), this, SLOT(slotSearch())); - connect(mMainWidget->searchLine, SIGNAL(textChanged(const QString&)), this, SLOT(slotSearchTextChanged(const QString&))); - connect(mMainWidget->searchErase, SIGNAL(clicked()), this, SLOT(slotSearchErase())); - connect(mMainWidget->contactComboBox, SIGNAL(activated(int)), this, SLOT(slotContactChanged(int))); - connect(mMainWidget->messageFilterBox, SIGNAL(activated(int)), this, SLOT(slotFilterChanged(int ))); - connect(mHtmlPart, SIGNAL(popupMenu(const QString &, const QPoint &)), this, SLOT(slotRightClick(const QString &, const QPoint &))); + connect(mHtmlPart->browserExtension(), TQT_SIGNAL(openURLRequestDelayed(const KURL &, const KParts::URLArgs &)), + this, TQT_SLOT(slotOpenURLRequest(const KURL &, const KParts::URLArgs &))); + connect(mMainWidget->dateListView, TQT_SIGNAL(clicked(TQListViewItem*)), this, TQT_SLOT(dateSelected(TQListViewItem*))); + connect(mMainWidget->searchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearch())); + connect(mMainWidget->searchLine, TQT_SIGNAL(returnPressed()), this, TQT_SLOT(slotSearch())); + connect(mMainWidget->searchLine, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotSearchTextChanged(const TQString&))); + connect(mMainWidget->searchErase, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearchErase())); + connect(mMainWidget->contactComboBox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotContactChanged(int))); + connect(mMainWidget->messageFilterBox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotFilterChanged(int ))); + connect(mHtmlPart, TQT_SIGNAL(popupMenu(const TQString &, const TQPoint &)), this, TQT_SLOT(slotRightClick(const TQString &, const TQPoint &))); //initActions KActionCollection* ac = new KActionCollection(this); - mCopyAct = KStdAction::copy( this, SLOT(slotCopy()), ac ); - mCopyURLAct = new KAction( i18n( "Copy Link Address" ), QString::fromLatin1( "editcopy" ), 0, this, SLOT( slotCopyURL() ), ac ); + mCopyAct = KStdAction::copy( this, TQT_SLOT(slotCopy()), ac ); + mCopyURLAct = new KAction( i18n( "Copy Link Address" ), TQString::fromLatin1( "editcopy" ), 0, this, TQT_SLOT( slotCopyURL() ), ac ); resize(650, 700); centerOnScreen(this); @@ -201,7 +201,7 @@ void HistoryDialog::init() } else { - QPtrListIterator it(mMetaContactList); + TQPtrListIterator it(mMetaContactList); for(; it.current(); ++it) { HistoryLogger logger(*it, this); @@ -211,7 +211,7 @@ void HistoryDialog::init() } initProgressBar(i18n("Loading..."),mInit.dateMCList.count()); - QTimer::singleShot(0,this,SLOT(slotLoadDays())); + TQTimer::singleShot(0,this,TQT_SLOT(slotLoadDays())); } void HistoryDialog::slotLoadDays() @@ -219,7 +219,7 @@ void HistoryDialog::slotLoadDays() if(mInit.dateMCList.isEmpty()) { if (!mMainWidget->searchLine->text().isEmpty()) - QTimer::singleShot(0, this, SLOT(slotSearch())); + TQTimer::singleShot(0, this, TQT_SLOT(slotSearch())); doneProgressBar(); return; } @@ -227,23 +227,23 @@ void HistoryDialog::slotLoadDays() DMPair pair(mInit.dateMCList.first()); mInit.dateMCList.pop_front(); HistoryLogger logger(pair.metaContact(), this); - QValueList dayList = logger.getDaysForMonth(pair.date()); + TQValueList dayList = logger.getDaysForMonth(pair.date()); for (unsigned int i=0; idateListView, c2Date, pair.metaContact()); } mMainWidget->searchProgress->advance(1); - QTimer::singleShot(0,this,SLOT(slotLoadDays())); + TQTimer::singleShot(0,this,TQT_SLOT(slotLoadDays())); } void HistoryDialog::init(Kopete::MetaContact *mc) { - QPtrList contacts=mc->contacts(); - QPtrListIterator it( contacts ); + TQPtrList contacts=mc->contacts(); + TQPtrListIterator it( contacts ); for( ; it.current(); ++it ) { @@ -254,17 +254,17 @@ void HistoryDialog::init(Kopete::MetaContact *mc) void HistoryDialog::init(Kopete::Contact *c) { // Get year and month list - QRegExp rx( "\\.(\\d\\d\\d\\d)(\\d\\d)" ); - const QString contact_in_filename=c->contactId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ); - QFileInfo *fi; + TQRegExp rx( "\\.(\\d\\d\\d\\d)(\\d\\d)" ); + const TQString contact_in_filename=c->contactId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ); + TQFileInfo *fi; // BEGIN check if there are Kopete 0.7.x - QDir d1(locateLocal("data",QString("kopete/logs/")+ - c->protocol()->pluginId().replace( QRegExp(QString::fromLatin1("[./~?*]")),QString::fromLatin1("-")) + TQDir d1(locateLocal("data",TQString("kopete/logs/")+ + c->protocol()->pluginId().replace( TQRegExp(TQString::fromLatin1("[./~?*]")),TQString::fromLatin1("-")) )); - d1.setFilter( QDir::Files | QDir::NoSymLinks ); - d1.setSorting( QDir::Name ); + d1.setFilter( TQDir::Files | TQDir::NoSymLinks ); + d1.setSorting( TQDir::Name ); const QFileInfoList *list1 = d1.entryInfoList(); if ( list1 != 0 ) @@ -276,7 +276,7 @@ void HistoryDialog::init(Kopete::Contact *c) { rx.search(fi->fileName()); - QDate cDate = QDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); + TQDate cDate = TQDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); DMPair pair(cDate, c->metaContact()); mInit.dateMCList.append(pair); @@ -287,14 +287,14 @@ void HistoryDialog::init(Kopete::Contact *c) } // END of kopete 0.7.x check - QString logDir = locateLocal("data",QString("kopete/logs/")+ - c->protocol()->pluginId().replace( QRegExp(QString::fromLatin1("[./~?*]")),QString::fromLatin1("-")) + - QString::fromLatin1( "/" ) + - c->account()->accountId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) + 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( "-" ) ) ); - QDir d(logDir); - d.setFilter( QDir::Files | QDir::NoSymLinks ); - d.setSorting( QDir::Name ); + TQDir d(logDir); + d.setFilter( TQDir::Files | TQDir::NoSymLinks ); + d.setSorting( TQDir::Name ); const QFileInfoList *list = d.entryInfoList(); if ( list != 0 ) { @@ -307,7 +307,7 @@ void HistoryDialog::init(Kopete::Contact *c) rx.search(fi->fileName()); // We search for an item in the list view with the same year. If then we add the month - QDate cDate = QDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); + TQDate cDate = TQDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); DMPair pair(cDate, c->metaContact()); mInit.dateMCList.append(pair); @@ -317,21 +317,21 @@ void HistoryDialog::init(Kopete::Contact *c) } } -void HistoryDialog::dateSelected(QListViewItem* it) +void HistoryDialog::dateSelected(TQListViewItem* it) { KListViewDateItem *item = static_cast(it); if (!item) return; - QDate chosenDate = item->date(); + TQDate chosenDate = item->date(); HistoryLogger logger(item->metaContact(), this); - QValueList msgs=logger.readMessages(chosenDate); + TQValueList msgs=logger.readMessages(chosenDate); setMessages(msgs); } -void HistoryDialog::setMessages(QValueList msgs) +void HistoryDialog::setMessages(TQValueList msgs) { // Clear View DOM::HTMLElement htmlBody = mHtmlPart->htmlDocument().body(); @@ -339,16 +339,16 @@ void HistoryDialog::setMessages(QValueList msgs) htmlBody.removeChild(htmlBody.childNodes().item(htmlBody.childNodes().length() - 1)); // ---- - QString dir = (QApplication::reverseLayout() ? QString::fromLatin1("rtl") : - QString::fromLatin1("ltr")); + TQString dir = (TQApplication::reverseLayout() ? TQString::fromLatin1("rtl") : + TQString::fromLatin1("ltr")); - QValueList::iterator it = msgs.begin(); + TQValueList::iterator it = msgs.begin(); - QString accountLabel; - QString resultHTML = "" + (*it).timestamp().date().toString() + "
"; - DOM::HTMLElement newNode = mHtmlPart->document().createElement(QString::fromLatin1("span")); - newNode.setAttribute(QString::fromLatin1("dir"), dir); + TQString accountLabel; + TQString resultHTML = "" + (*it).timestamp().date().toString() + "
"; + DOM::HTMLElement newNode = mHtmlPart->document().createElement(TQString::fromLatin1("span")); + newNode.setAttribute(TQString::fromLatin1("dir"), dir); newNode.setInnerHTML(resultHTML); mHtmlPart->htmlDocument().body().appendChild(newNode); @@ -370,7 +370,7 @@ void HistoryDialog::setMessages(QValueList msgs) } accountLabel = (*it).from()->account()->accountLabel(); - QString body = (*it).parsedBody(); + TQString body = (*it).parsedBody(); if (!mMainWidget->searchLine->text().isEmpty()) // If there is a search, then we hightlight the keywords @@ -384,8 +384,8 @@ void HistoryDialog::setMessages(QValueList msgs) : "textColor().light(200).name() + "\">< ") + body + "
"; - newNode = mHtmlPart->document().createElement(QString::fromLatin1("span")); - newNode.setAttribute(QString::fromLatin1("dir"), dir); + newNode = mHtmlPart->document().createElement(TQString::fromLatin1("span")); + newNode.setAttribute(TQString::fromLatin1("dir"), dir); newNode.setInnerHTML(resultHTML); mHtmlPart->htmlDocument().body().appendChild(newNode); @@ -405,7 +405,7 @@ void HistoryDialog::slotOpenURLRequest(const KURL &url, const KParts::URLArgs &/ } // Disable search button if there is no search text -void HistoryDialog::slotSearchTextChanged(const QString& searchText) +void HistoryDialog::slotSearchTextChanged(const TQString& searchText) { if (searchText.isEmpty()) { @@ -442,8 +442,8 @@ void HistoryDialog::slotSearchErase() * We do the search respecting the current metacontact filter item. To do this, we iterate over the * elements in the KListView (KListViewDateItems) and, for each one, we iterate over its subcontacts, * manually searching the log files of each one. To avoid searching files twice, the months that have -* been searched already are stored in searchedMonths. The matches are placed in the matches QMap. -* Finally, the current date item is checked in the matches QMap, and if it is present, it is shown. +* been searched already are stored in searchedMonths. The matches are placed in the matches TQMap. +* Finally, the current date item is checked in the matches TQMap, and if it is present, it is shown. * * Keyword highlighting is done in setMessages() : if the search field isn't empty, we highlight the * search keyword. @@ -454,9 +454,9 @@ void HistoryDialog::slotSearch() { if (mMainWidget->dateListView->childCount() == 0) return; - QRegExp rx("^ ([^<]*)<"); - QMap > monthsSearched; - QMap > matches; + TQRegExp rx("^ ([^<]*)<"); + TQMap > monthsSearched; + TQMap > matches; // cancel button pressed if (mSearching) @@ -480,18 +480,18 @@ void HistoryDialog::slotSearch() qApp->processEvents(); if (!mSearching) return; - QDate month(curItem->date().year(),curItem->date().month(),1); + 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())) { monthsSearched[month].push_back(curItem->metaContact()); - QPtrList contacts = curItem->metaContact()->contacts(); - for(QPtrListIterator it( contacts ); it.current(); ++it) + TQPtrList contacts = curItem->metaContact()->contacts(); + for(TQPtrListIterator it( contacts ); it.current(); ++it) { // get filename and open file - QString filename(HistoryLogger::getFileName(*it, curItem->date())); - if (!QFile::exists(filename)) continue; - QFile file(filename); + TQString filename(HistoryLogger::getFileName(*it, curItem->date())); + if (!TQFile::exists(filename)) continue; + TQFile file(filename); file.open(IO_ReadOnly); if (!file.isOpen()) { @@ -500,8 +500,8 @@ void HistoryDialog::slotSearch() continue; } - QTextStream stream(&file); - QString textLine; + TQTextStream stream(&file); + TQString textLine; while(!stream.atEnd()) { textLine = stream.readLine(); @@ -511,7 +511,7 @@ void HistoryDialog::slotSearch() { // only match message body if (rx.cap(2).contains(mMainWidget->searchLine->text())) - matches[QDate(curItem->date().year(),curItem->date().month(),rx.cap(1).toInt())].push_back(curItem->metaContact()); + 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 @@ -558,7 +558,7 @@ void HistoryDialog::slotContactChanged(int index) } } -void HistoryDialog::initProgressBar(const QString& text, int nbSteps) +void HistoryDialog::initProgressBar(const TQString& text, int nbSteps) { mMainWidget->searchProgress->setTotalSteps(nbSteps); mMainWidget->searchProgress->setProgress(0); @@ -572,7 +572,7 @@ void HistoryDialog::doneProgressBar() mMainWidget->statusLabel->setText(i18n("Ready")); } -void HistoryDialog::slotRightClick(const QString &url, const QPoint &point) +void HistoryDialog::slotRightClick(const TQString &url, const TQPoint &point) { KPopupMenu *chatWindowPopup = 0L; chatWindowPopup = new KPopupMenu(); @@ -586,28 +586,28 @@ void HistoryDialog::slotRightClick(const QString &url, const QPoint &point) mCopyAct->setEnabled( mHtmlPart->hasSelection() ); mCopyAct->plug( chatWindowPopup ); - connect( chatWindowPopup, SIGNAL( aboutToHide() ), chatWindowPopup, SLOT( deleteLater() ) ); + connect( chatWindowPopup, TQT_SIGNAL( aboutToHide() ), chatWindowPopup, TQT_SLOT( deleteLater() ) ); chatWindowPopup->popup(point); } void HistoryDialog::slotCopy() { - QString qsSelection; + TQString qsSelection; qsSelection = mHtmlPart->selectedText(); if ( qsSelection.isEmpty() ) return; - disconnect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); - QApplication::clipboard()->setText(qsSelection, QClipboard::Clipboard); - QApplication::clipboard()->setText(qsSelection, QClipboard::Selection); - connect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); + disconnect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); + TQApplication::clipboard()->setText(qsSelection, QClipboard::Clipboard); + TQApplication::clipboard()->setText(qsSelection, QClipboard::Selection); + connect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); } void HistoryDialog::slotCopyURL() { - disconnect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); - QApplication::clipboard()->setText( mURL, QClipboard::Clipboard); - QApplication::clipboard()->setText( mURL, QClipboard::Selection); - connect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); + disconnect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); + TQApplication::clipboard()->setText( mURL, QClipboard::Clipboard); + TQApplication::clipboard()->setText( mURL, QClipboard::Selection); + connect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); } #include "historydialog.moc" -- cgit v1.2.1