diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/plugins/statistics | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/statistics')
-rw-r--r-- | kopete/plugins/statistics/statisticscontact.cpp | 128 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticscontact.h | 40 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticsdb.cpp | 36 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticsdb.h | 4 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticsdcopiface.h | 20 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticsdialog.cpp | 164 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticsdialog.h | 12 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticsplugin.cpp | 98 | ||||
-rw-r--r-- | kopete/plugins/statistics/statisticsplugin.h | 36 |
9 files changed, 269 insertions, 269 deletions
diff --git a/kopete/plugins/statistics/statisticscontact.cpp b/kopete/plugins/statistics/statisticscontact.cpp index e9068fe5..821b8f59 100644 --- a/kopete/plugins/statistics/statisticscontact.cpp +++ b/kopete/plugins/statistics/statisticscontact.cpp @@ -16,8 +16,8 @@ #include <stdlib.h> -#include <qvaluelist.h> -#include <quuid.h> +#include <tqvaluelist.h> +#include <tquuid.h> #include <kdebug.h> #include <klocale.h> @@ -31,7 +31,7 @@ StatisticsContact::StatisticsContact(Kopete::MetaContact *mc, StatisticsDB *db) : m_metaContact(mc),m_db(db), m_oldStatus(Kopete::OnlineStatus::Unknown) { m_isChatWindowOpen = false; - m_oldStatusDateTime = QDateTime::currentDateTime(); + m_oldStatusDateTime = TQDateTime::currentDateTime(); // Last*Changed are always false at start m_timeBetweenTwoMessagesChanged = false; @@ -48,9 +48,9 @@ StatisticsContact::~StatisticsContact() if (m_statisticsContactId.isEmpty()) return; - commonStatsSave("timebetweentwomessages",QString::number(m_timeBetweenTwoMessages), - QString::number(m_timeBetweenTwoMessagesOn), m_timeBetweenTwoMessagesChanged); - commonStatsSave("messagelength",QString::number(m_messageLength), QString::number(m_messageLengthOn), m_messageLengthChanged); + commonStatsSave("timebetweentwomessages",TQString::number(m_timeBetweenTwoMessages), + TQString::number(m_timeBetweenTwoMessagesOn), m_timeBetweenTwoMessagesChanged); + commonStatsSave("messagelength",TQString::number(m_messageLength), TQString::number(m_messageLengthOn), m_messageLengthChanged); commonStatsSave("lasttalk", m_lastTalk.toString(), "", m_lastTalkChanged); commonStatsSave("lastpresent", m_lastPresent.toString(), "", m_lastPresentChanged); } @@ -58,7 +58,7 @@ StatisticsContact::~StatisticsContact() void StatisticsContact::initialize(Kopete::Contact *c) { // Generate statisticsContactId or get it from database - QStringList buffer = m_db->query(QString("SELECT statisticid FROM contacts " + TQStringList buffer = m_db->query(TQString("SELECT statisticid FROM contacts " "WHERE contactid LIKE '%1';" ).arg(c->contactId())); @@ -66,7 +66,7 @@ void StatisticsContact::initialize(Kopete::Contact *c) { // Check if we don't have old data if ( !c->metaContact()->metaContactId().isEmpty() && - !m_db->query(QString("SELECT metacontactid FROM commonstats " + !m_db->query(TQString("SELECT metacontactid FROM commonstats " "WHERE metacontactid LIKE '%1';" ).arg(c->metaContact()->metaContactId())).isEmpty()) { @@ -80,7 +80,7 @@ void StatisticsContact::initialize(Kopete::Contact *c) } // Assign contactId to m_statisticsContactId - m_db->query(QString("INSERT INTO contacts (statisticid, contactid) VALUES('%1', '%2');" + m_db->query(TQString("INSERT INTO contacts (statisticid, contactid) VALUES('%1', '%2');" ).arg(m_statisticsContactId).arg(c->contactId())); } else @@ -94,8 +94,8 @@ void StatisticsContact::initialize(Kopete::Contact *c) commonStatsCheck("messagelength", m_messageLength, m_messageLengthOn, 0, 0); // Check for last talk - QString lastTalk; - QString dummy = ""; + TQString lastTalk; + TQString dummy = ""; commonStatsCheck("lasttalk", lastTalk, dummy); if (lastTalk.isEmpty()) { @@ -103,15 +103,15 @@ void StatisticsContact::initialize(Kopete::Contact *c) m_lastTalkChanged = true; } else - m_lastTalk = QDateTime::fromString(lastTalk); + m_lastTalk = TQDateTime::fromString(lastTalk); // Get last time a message was received - m_lastMessageReceived = QDateTime::currentDateTime(); + m_lastMessageReceived = TQDateTime::currentDateTime(); // Check for lastPresent - QString lastPresent = ""; + TQString lastPresent = ""; commonStatsCheck("lastpresent", lastPresent, dummy); if (lastPresent.isEmpty()) { @@ -119,7 +119,7 @@ void StatisticsContact::initialize(Kopete::Contact *c) m_lastPresentChanged = true; } else - m_lastPresent = QDateTime::fromString(lastPresent); + m_lastPresent = TQDateTime::fromString(lastPresent); } void StatisticsContact::contactAdded( Kopete::Contact *c ) @@ -127,12 +127,12 @@ void StatisticsContact::contactAdded( Kopete::Contact *c ) if ( !m_statisticsContactId.isEmpty() ) { // Check if contact is allready in database if not add it - if (m_db->query(QString("SELECT id FROM contacts " + if (m_db->query(TQString("SELECT id FROM contacts " "WHERE statisticid LIKE '%1' AND contactid LIKE '%2';" ).arg(m_statisticsContactId).arg(c->contactId())).isEmpty()) { // Assign contactId to m_statisticsContactId - m_db->query(QString("INSERT INTO contacts (statisticid, contactid) VALUES('%1', '%2');" + m_db->query(TQString("INSERT INTO contacts (statisticid, contactid) VALUES('%1', '%2');" ).arg(m_statisticsContactId).arg(c->contactId())); } kdDebug() << k_funcinfo << " m_statisticsContactId: " << m_statisticsContactId << endl; @@ -150,7 +150,7 @@ void StatisticsContact::contactRemoved( Kopete::Contact *c ) return; kdDebug() << k_funcinfo << " m_statisticsContactId: " << m_statisticsContactId << endl; - m_db->query(QString("DELETE FROM contacts WHERE statisticid LIKE '%1' AND contactid LIKE '%2';" + m_db->query(TQString("DELETE FROM contacts WHERE statisticid LIKE '%1' AND contactid LIKE '%2';" ).arg(m_statisticsContactId).arg(c->contactId())); } @@ -160,14 +160,14 @@ void StatisticsContact::removeFromDB() return; kdDebug() << k_funcinfo << " m_statisticsContactId: " << m_statisticsContactId << endl; - m_db->query(QString("DELETE FROM contacts WHERE statisticid LIKE '%1';").arg(m_statisticsContactId)); - m_db->query(QString("DELETE FROM contactstatus WHERE metacontactid LIKE '%1';").arg(m_statisticsContactId)); - m_db->query(QString("DELETE FROM commonstats WHERE metacontactid LIKE '%1';").arg(m_statisticsContactId)); + m_db->query(TQString("DELETE FROM contacts WHERE statisticid LIKE '%1';").arg(m_statisticsContactId)); + m_db->query(TQString("DELETE FROM contactstatus WHERE metacontactid LIKE '%1';").arg(m_statisticsContactId)); + m_db->query(TQString("DELETE FROM commonstats WHERE metacontactid LIKE '%1';").arg(m_statisticsContactId)); - m_statisticsContactId = QString::null; + m_statisticsContactId = TQString::null; } -void StatisticsContact::commonStatsSave(const QString name, const QString statVar1, const QString statVar2, const bool statVarChanged) +void StatisticsContact::commonStatsSave(const TQString name, const TQString statVar1, const TQString statVar2, const bool statVarChanged) { // Only update the database if there was a change if (!statVarChanged) return; @@ -175,28 +175,28 @@ void StatisticsContact::commonStatsSave(const QString name, const QString statVa if (m_statisticsContactId.isEmpty()) return; - m_db->query(QString("UPDATE commonstats SET statvalue1 = '%1', statvalue2='%2'" + m_db->query(TQString("UPDATE commonstats SET statvalue1 = '%1', statvalue2='%2'" "WHERE statname LIKE '%3' AND metacontactid LIKE '%4';").arg(statVar1).arg(statVar2).arg(name).arg(m_statisticsContactId)); } -void StatisticsContact::commonStatsCheck(const QString name, int& statVar1, int& statVar2, const int defaultValue1, const int defaultValue2) +void StatisticsContact::commonStatsCheck(const TQString name, int& statVar1, int& statVar2, const int defaultValue1, const int defaultValue2) { - QString a = QString::number(statVar1); - QString b = QString::number(statVar2); + TQString a = TQString::number(statVar1); + TQString b = TQString::number(statVar2); - commonStatsCheck(name, a, b, QString::number(defaultValue1), QString::number(defaultValue2)); + commonStatsCheck(name, a, b, TQString::number(defaultValue1), TQString::number(defaultValue2)); statVar1 = a.toInt(); statVar2 = b.toInt(); } -void StatisticsContact::commonStatsCheck(const QString name, QString& statVar1, QString& statVar2, const QString defaultValue1, const QString defaultValue2) +void StatisticsContact::commonStatsCheck(const TQString name, TQString& statVar1, TQString& statVar2, const TQString defaultValue1, const TQString defaultValue2) { if (m_statisticsContactId.isEmpty()) return; - QStringList buffer = m_db->query(QString("SELECT statvalue1,statvalue2 FROM commonstats WHERE statname LIKE '%1' AND metacontactid LIKE '%2';").arg(name, m_statisticsContactId)); + TQStringList buffer = m_db->query(TQString("SELECT statvalue1,statvalue2 FROM commonstats WHERE statname LIKE '%1' AND metacontactid LIKE '%2';").arg(name, m_statisticsContactId)); if (!buffer.isEmpty()) { statVar1 = buffer[0]; @@ -204,7 +204,7 @@ void StatisticsContact::commonStatsCheck(const QString name, QString& statVar1, } else { - m_db->query(QString("INSERT INTO commonstats (metacontactid, statname, statvalue1, statvalue2) VALUES('%1', '%2', 0, 0);").arg(m_statisticsContactId, name)); + m_db->query(TQString("INSERT INTO commonstats (metacontactid, statname, statvalue1, statvalue2) VALUES('%1', '%2', 0, 0);").arg(m_statisticsContactId, name)); statVar1 = defaultValue1; statVar2 = defaultValue2; } @@ -234,7 +234,7 @@ void StatisticsContact::commonStatsCheck(const QString name, QString& statVar1, void StatisticsContact::newMessageReceived(Kopete::Message& m) { kdDebug() << "statistics: new message received" << endl; - QDateTime currentDateTime = QDateTime::currentDateTime(); + TQDateTime currentDateTime = TQDateTime::currentDateTime(); if (m_timeBetweenTwoMessagesOn != -1 && m_isChatWindowOpen) { @@ -269,17 +269,17 @@ void StatisticsContact::onlineStatusChanged(Kopete::OnlineStatus::StatusType sta if (m_statisticsContactId.isEmpty()) return; - QDateTime currentDateTime = QDateTime::currentDateTime(); + TQDateTime currentDateTime = TQDateTime::currentDateTime(); /// We don't want to log if oldStatus is unknown /// the change could not be a real one; see StatisticsPlugin::slotMySelfOnlineStatusChanged if (m_oldStatus != Kopete::OnlineStatus::Unknown) { - kdDebug() << "statistics - status change for "<< metaContact()->metaContactId() << " : "<< QString::number(m_oldStatus) << endl; - m_db->query(QString("INSERT INTO contactstatus " + kdDebug() << "statistics - status change for "<< metaContact()->metaContactId() << " : "<< TQString::number(m_oldStatus) << endl; + m_db->query(TQString("INSERT INTO contactstatus " "(metacontactid, status, datetimebegin, datetimeend) " - "VALUES('%1', '%2', '%3', '%4'" ");").arg(m_statisticsContactId).arg(Kopete::OnlineStatus::statusTypeToString(m_oldStatus)).arg(QString::number(m_oldStatusDateTime.toTime_t())).arg(QString::number(currentDateTime.toTime_t()))); + "VALUES('%1', '%2', '%3', '%4'" ");").arg(m_statisticsContactId).arg(Kopete::OnlineStatus::statusTypeToString(m_oldStatus)).arg(TQString::number(m_oldStatusDateTime.toTime_t())).arg(TQString::number(currentDateTime.toTime_t()))); } if (m_oldStatus == Kopete::OnlineStatus::Online || m_oldStatus == Kopete::OnlineStatus::Away) @@ -294,12 +294,12 @@ void StatisticsContact::onlineStatusChanged(Kopete::OnlineStatus::StatusType sta } -bool StatisticsContact::wasStatus(QDateTime dt, Kopete::OnlineStatus::StatusType status) +bool StatisticsContact::wasStatus(TQDateTime dt, Kopete::OnlineStatus::StatusType status) { if (m_statisticsContactId.isEmpty()) return false; - QStringList values = m_db->query(QString("SELECT status, datetimebegin, datetimeend " + TQStringList values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend " "FROM contactstatus WHERE metacontactid LIKE '%1' AND datetimebegin <= %2 AND datetimeend >= %3 " "AND status LIKE '%4' " "ORDER BY datetimebegin;" @@ -310,12 +310,12 @@ bool StatisticsContact::wasStatus(QDateTime dt, Kopete::OnlineStatus::StatusType return false; } -QString StatisticsContact::statusAt(QDateTime dt) +TQString StatisticsContact::statusAt(TQDateTime dt) { if (m_statisticsContactId.isEmpty()) return ""; - QStringList values = m_db->query(QString("SELECT status, datetimebegin, datetimeend " + TQStringList values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend " "FROM contactstatus WHERE metacontactid LIKE '%1' AND datetimebegin <= %2 AND datetimeend >= %3 " "ORDER BY datetimebegin;" ).arg(m_statisticsContactId).arg(dt.toTime_t()).arg(dt.toTime_t())); @@ -324,28 +324,28 @@ QString StatisticsContact::statusAt(QDateTime dt) else return ""; } -QString StatisticsContact::mainStatusDate(const QDate& date) +TQString StatisticsContact::mainStatusDate(const TQDate& date) { if (m_statisticsContactId.isEmpty()) return ""; - QDateTime dt1(date, QTime(0,0,0)); - QDateTime dt2(date.addDays(1), QTime(0,0,0)); + TQDateTime dt1(date, TQTime(0,0,0)); + TQDateTime dt2(date.addDays(1), TQTime(0,0,0)); kdDebug() << "dt1:" << dt1.toString() << " dt2:" << dt2.toString() << endl; - QString request = QString("SELECT status, datetimebegin, datetimeend, metacontactid " + TQString request = TQString("SELECT status, datetimebegin, datetimeend, metacontactid " "FROM contactstatus WHERE metacontactid = '%1' AND " "(datetimebegin >= %2 AND datetimebegin <= %3 OR " "datetimeend >= %4 AND datetimeend <= %5) " "ORDER BY datetimebegin;" ).arg(m_statisticsContactId).arg(dt1.toTime_t()).arg(dt2.toTime_t()).arg(dt1.toTime_t()).arg(dt2.toTime_t()); kdDebug() << request << endl; - QStringList values = m_db->query(request); + TQStringList values = m_db->query(request); unsigned int online = 0, offline = 0, away = 0; for(uint i=0; i<values.count(); i+=4) { unsigned int datetimebegin = values[i+1].toInt(), datetimeend = values[i+2].toInt(); - kdDebug() << "statistics: id "<< values[i+3]<< " status " << values[i] << " datetimeend " << QString::number(datetimeend) << " datetimebegin " << QString::number(datetimebegin) << endl; + kdDebug() << "statistics: id "<< values[i+3]<< " status " << values[i] << " datetimeend " << TQString::number(datetimeend) << " datetimebegin " << TQString::number(datetimebegin) << endl; if (datetimebegin <= dt1.toTime_t()) datetimebegin = dt1.toTime_t(); if (datetimeend >= dt2.toTime_t()) datetimeend = dt2.toTime_t(); @@ -366,35 +366,35 @@ QString StatisticsContact::mainStatusDate(const QDate& date) return ""; } -// QDateTime StatisticsContact::nextOfflineEvent() +// TQDateTime StatisticsContact::nextOfflineEvent() // { // return nextEvent(Kopete::OnlineStatus::Offline); // } // -// QDateTime StatisticsContact::nextOnlineEvent() +// TQDateTime StatisticsContact::nextOnlineEvent() // { // return nextEvent(Kopete::OnlineStatus::Online); // } -// QDateTime StatisticsContact::nextEvent(const Kopete::OnlineStatus::StatusType& status) +// TQDateTime StatisticsContact::nextEvent(const Kopete::OnlineStatus::StatusType& status) // { // // } -QValueList<QTime> StatisticsContact::mainEvents(const Kopete::OnlineStatus::StatusType& status) +TQValueList<TQTime> StatisticsContact::mainEvents(const Kopete::OnlineStatus::StatusType& status) { - QStringList buffer; - QValueList<QTime> mainEvents; + TQStringList buffer; + TQValueList<TQTime> mainEvents; if (m_statisticsContactId.isEmpty()) return mainEvents; - QDateTime currentDateTime = QDateTime::currentDateTime(); - buffer = m_db->query(QString("SELECT datetimebegin, datetimeend, status FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin").arg(m_statisticsContactId)); + TQDateTime currentDateTime = TQDateTime::currentDateTime(); + buffer = m_db->query(TQString("SELECT datetimebegin, datetimeend, status FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin").arg(m_statisticsContactId)); // Only select the events for which the previous is not Unknown AND the status is status. - QStringList values; + TQStringList values; for (uint i=0; i<buffer.count(); i += 3) { if (buffer[i+2] == Kopete::OnlineStatus::statusTypeToString(status) @@ -409,7 +409,7 @@ QValueList<QTime> StatisticsContact::mainEvents(const Kopete::OnlineStatus::Stat // First we compute the average number of events/day : avEventsPerDay; int avEventsPerDay = 0; - QDateTime dt1, dt2; + TQDateTime dt1, dt2; dt1.setTime_t(values[0].toInt()); dt2.setTime_t(values[values.count()-1].toInt()); @@ -417,19 +417,19 @@ QValueList<QTime> StatisticsContact::mainEvents(const Kopete::OnlineStatus::Stat kdDebug() << "statistics: average events per day : " <<avEventsPerDay << endl; // We want to work on hours - QValueList<int> hoursValues; + TQValueList<int> hoursValues; for (uint i=0; i<values.count(); i++) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(values[i].toInt()); - hoursValues.push_back(QTime(0, 0, 0).secsTo(dt.time())); + hoursValues.push_back(TQTime(0, 0, 0).secsTo(dt.time())); } // Sort the list qHeapSort(hoursValues); // Then we put some centroids (centroids in [0..24[) - QValueList<int> centroids; + TQValueList<int> centroids; int incr=qRound((double)hoursValues.count()/(double)avEventsPerDay); incr = incr ? incr : 1; for (uint i=0; i<hoursValues.count(); i+=incr) @@ -447,7 +447,7 @@ QValueList<QTime> StatisticsContact::mainEvents(const Kopete::OnlineStatus::Stat { kdDebug() << "statistics: new centroid : " << centroids[i] << endl; - QTime dt(0, 0, 0); + TQTime dt(0, 0, 0); dt = dt.addSecs(centroids[i]); mainEvents.push_back(dt); } @@ -456,12 +456,12 @@ QValueList<QTime> StatisticsContact::mainEvents(const Kopete::OnlineStatus::Stat return mainEvents; } -QValueList<int> StatisticsContact::computeCentroids(const QValueList<int>& centroids, const QValueList<int>& values) +TQValueList<int> StatisticsContact::computeCentroids(const TQValueList<int>& centroids, const TQValueList<int>& values) { kdDebug() << "statistics: enter compute centroids"<< endl; - QValueList<int> whichCentroid; // whichCentroid[i] = j <=> values[i] has centroid j for closest one - QValueList<int> newCentroids; + TQValueList<int> whichCentroid; // whichCentroid[i] = j <=> values[i] has centroid j for closest one + TQValueList<int> newCentroids; for (uint i=0; i<values.count(); i++) // Iterates over the values. For each one we need to get the closest centroid. { diff --git a/kopete/plugins/statistics/statisticscontact.h b/kopete/plugins/statistics/statisticscontact.h index 217000db..719a65da 100644 --- a/kopete/plugins/statistics/statisticscontact.h +++ b/kopete/plugins/statistics/statisticscontact.h @@ -52,7 +52,7 @@ public: /** \brief Access method * \return m_statisticsContactId */ - QString statisticsContactId() { return m_statisticsContactId; } + TQString statisticsContactId() { return m_statisticsContactId; } /** \brief Access method * \return m_oldStatus @@ -62,7 +62,7 @@ public: /** \brief Access method * \return m_oldStatusDateTime */ - QDateTime oldStatusDateTime() { return m_oldStatusDateTime; } + TQDateTime oldStatusDateTime() { return m_oldStatusDateTime; } /** \brief Access method * \return m_messageLength @@ -76,12 +76,12 @@ public: * \brief Access method * \return m_lastTalk */ - QDateTime lastTalk() { return m_lastTalk; } + TQDateTime lastTalk() { return m_lastTalk; } /** * \brief Access method * \return m_lastPresent */ - QDateTime lastPresent() { return m_lastPresent; } + TQDateTime lastPresent() { return m_lastPresent; } /** * \brief sets \p m_isChatWindowOpen to true */ @@ -106,17 +106,17 @@ public: /** * \returns true if contact was status at dt, false else. */ - bool wasStatus(QDateTime dt, Kopete::OnlineStatus::StatusType status); + bool wasStatus(TQDateTime dt, Kopete::OnlineStatus::StatusType status); /** * \returns the status of the contact at dt. Return false if dt is invalid. */ - QString statusAt(QDateTime dt); + TQString statusAt(TQDateTime dt); /** * \returns the main (most used) status of the contact at date (not time) dt. return false if dt is invalid. */ - QString mainStatusDate(const QDate& date); + TQString mainStatusDate(const TQDate& date); /* * Prevision methods */ @@ -126,25 +126,25 @@ public: // * \param status the status to be checked. // * \retval nextEventDateTime the next event average prevision datetime. // */ -// QDateTime nextEvent(const Kopete::OnlineStatus::StatusType& status); +// TQDateTime nextEvent(const Kopete::OnlineStatus::StatusType& status); // // /** // * \brief Convenience method for nextEvent with Offline status // */ -// QDateTime nextOfflineEvent(); +// TQDateTime nextOfflineEvent(); // // /** // * \brief Convenience method for nextEvent with Online status // */ -// QDateTime nextOnlineEvent(); +// TQDateTime nextOnlineEvent(); /** * \brief computes the main "status" events for the contact */ - QValueList<QTime> mainEvents(const Kopete::OnlineStatus::StatusType& status); + TQValueList<TQTime> mainEvents(const Kopete::OnlineStatus::StatusType& status); /// \brief used by mainEvents() - QValueList<int> computeCentroids(const QValueList<int>& centroids, const QValueList<int>& values); + TQValueList<int> computeCentroids(const TQValueList<int>& centroids, const TQValueList<int>& values); /** * \brief adds contact to "contacts" database and generates m_statisticsContactId if needed @@ -179,13 +179,13 @@ private: * \retval statvar1 * \retval statvar2 */ - void commonStatsCheck(const QString name, QString& statVar1, QString& statVar2, const QString defaultValue1 = "", const QString defaultValue2 = ""); + void commonStatsCheck(const TQString name, TQString& statVar1, TQString& statVar2, const TQString defaultValue1 = "", const TQString defaultValue2 = ""); /** * @brief Same as commonStatsCheck for integers. * Provided for convenience */ - void commonStatsCheck(const QString name, int& statVar1, int& statVar2, const int defaultValue1 = 0, const int defaultValue2 = -1); + void commonStatsCheck(const TQString name, int& statVar1, int& statVar2, const int defaultValue1 = 0, const int defaultValue2 = -1); /** * @brief Save a value in the "commonstats" table @@ -194,7 +194,7 @@ private: * \param statVar2 the second stat we can save in this table for this entry * \param statVarChanged if this param is true, we save. Else, we don't. Spare some disk usage. */ - void commonStatsSave(const QString name, const QString statVar1, const QString statVar2, const bool statVarChanged); + void commonStatsSave(const TQString name, const TQString statVar1, const TQString statVar2, const bool statVarChanged); /** * Kopete::MetaContact linked to this StatisticsContact @@ -213,7 +213,7 @@ private: */ Kopete::OnlineStatus::StatusType m_oldStatus; /// We keep the old status datetime here - QDateTime m_oldStatusDateTime; + TQDateTime m_oldStatusDateTime; /** * Average time this user takes between two of his messages @@ -223,7 +223,7 @@ private: bool m_timeBetweenTwoMessagesChanged; /// Date at which the last message was received. /// Used to compute m_timeBetweenTwoMessages - QDateTime m_lastMessageReceived; + TQDateTime m_lastMessageReceived; /// This is the ponderation corresponding to m_timeBetweenTwoMessagesOn int m_timeBetweenTwoMessagesOn; /// We don't count time if a chatwindow isn't open @@ -240,20 +240,20 @@ private: /** * Last time user talked with this contact */ - QDateTime m_lastTalk; + TQDateTime m_lastTalk; bool m_lastTalkChanged; /** * Last time user was present (=online or away) */ - QDateTime m_lastPresent; + TQDateTime m_lastPresent; bool m_lastPresentChanged; /** * Unique id that identifies StatisticsContact * It's also identifier for database records */ - QString m_statisticsContactId; + TQString m_statisticsContactId; }; diff --git a/kopete/plugins/statistics/statisticsdb.cpp b/kopete/plugins/statistics/statisticsdb.cpp index 450c4371..c0a41232 100644 --- a/kopete/plugins/statistics/statisticsdb.cpp +++ b/kopete/plugins/statistics/statisticsdb.cpp @@ -14,7 +14,7 @@ ************************************************************************* */ -#include <qfile.h> +#include <tqfile.h> #include "sqlite/sqlite3.h" @@ -33,15 +33,15 @@ StatisticsDB::StatisticsDB() { - QCString path = (::locateLocal("appdata", "kopete_statistics-0.1.db")).latin1(); + TQCString path = (::locateLocal("appdata", "kopete_statistics-0.1.db")).latin1(); kdDebug() << "statistics: DB path:" << path << endl; // Open database file and check for correctness bool failOpen = true; - QFile file( path ); + TQFile file( path ); if ( file.open( IO_ReadOnly ) ) { - QString format; + TQString format; file.readLine( format, 50 ); if ( !format.startsWith( "SQLite format 3" ) ) { @@ -59,18 +59,18 @@ StatisticsDB::StatisticsDB() if ( failOpen ) { // Remove old db file; create new - QFile::remove( path ); + TQFile::remove( path ); sqlite3_open( path, &m_db ); } kdDebug() << "[Statistics] Contructor"<< endl; // Creates the tables if they do not exist. - QStringList result = query("SELECT name FROM sqlite_master WHERE type='table'"); + TQStringList result = query("SELECT name FROM sqlite_master WHERE type='table'"); if (!result.contains("contacts")) { - query(QString("CREATE TABLE contacts " + query(TQString("CREATE TABLE contacts " "(id INTEGER PRIMARY KEY," "statisticid TEXT," "contactid TEXT" @@ -80,7 +80,7 @@ StatisticsDB::StatisticsDB() if (!result.contains("contactstatus")) { kdDebug() << "[Statistics] Database empty"<< endl; - query(QString("CREATE TABLE contactstatus " + query(TQString("CREATE TABLE contactstatus " "(id INTEGER PRIMARY KEY," "metacontactid TEXT," "status TEXT," @@ -92,7 +92,7 @@ StatisticsDB::StatisticsDB() if (!result.contains("commonstats")) { // To store things like the contact answer time etc. - query(QString("CREATE TABLE commonstats" + query(TQString("CREATE TABLE commonstats" " (id INTEGER PRIMARY KEY," "metacontactid TEXT," "statname TEXT," // for instance, answertime, lastmessage, messagelength ... @@ -104,7 +104,7 @@ StatisticsDB::StatisticsDB() /// @fixme This is not used anywhere if (!result.contains("statsgroup")) { - query(QString("CREATE TABLE statsgroup" + query(TQString("CREATE TABLE statsgroup" "(id INTEGER PRIMARY KEY," "datetimebegin INTEGER," "datetimeend INTEGER," @@ -123,9 +123,9 @@ StatisticsDB::~StatisticsDB() * @param statement SQL program to execute. Only one SQL statement is allowed. * @param debug Set to true for verbose debug output. * @retval names Will contain all column names, set to NULL if not used. - * @return The queried data, or QStringList() on error. + * @return The queried data, or TQStringList() on error. */ - QStringList StatisticsDB::query( const QString& statement, QStringList* const names, bool debug ) + TQStringList StatisticsDB::query( const TQString& statement, TQStringList* const names, bool debug ) { if ( debug ) @@ -136,11 +136,11 @@ StatisticsDB::~StatisticsDB() if ( !m_db ) { kdError() << k_funcinfo << "[CollectionDB] SQLite pointer == NULL.\n"; - return QStringList(); + return TQStringList(); } int error; - QStringList values; + TQStringList values; const char* tail; sqlite3_stmt* stmt; @@ -153,7 +153,7 @@ StatisticsDB::~StatisticsDB() kdError() << sqlite3_errmsg( m_db ) << endl; kdError() << "on query: " << statement << endl; - return QStringList(); + return TQStringList(); } int busyCnt = 0; @@ -180,8 +180,8 @@ StatisticsDB::~StatisticsDB() //iterate over columns for ( int i = 0; i < number; i++ ) { - values << QString::fromUtf8( (const char*) sqlite3_column_text( stmt, i ) ); - if ( names ) *names << QString( sqlite3_column_name( stmt, i ) ); + values << TQString::fromUtf8( (const char*) sqlite3_column_text( stmt, i ) ); + if ( names ) *names << TQString( sqlite3_column_name( stmt, i ) ); } } //deallocate vm ressources @@ -193,7 +193,7 @@ StatisticsDB::~StatisticsDB() kdError() << sqlite3_errmsg( m_db ) << endl; kdError() << "on query: " << statement << endl; - return QStringList(); + return TQStringList(); } if ( debug ) diff --git a/kopete/plugins/statistics/statisticsdb.h b/kopete/plugins/statistics/statisticsdb.h index 130b1d0e..444e80c0 100644 --- a/kopete/plugins/statistics/statisticsdb.h +++ b/kopete/plugins/statistics/statisticsdb.h @@ -26,8 +26,8 @@ public: StatisticsDB(); ~StatisticsDB(); //sql helper methods - QStringList query( const QString& statement, QStringList* const names = 0, bool debug = false ); - QString escapeString( QString string ); + TQStringList query( const TQString& statement, TQStringList* const names = 0, bool debug = false ); + TQString escapeString( TQString string ); private: sqlite3 *m_db; }; diff --git a/kopete/plugins/statistics/statisticsdcopiface.h b/kopete/plugins/statistics/statisticsdcopiface.h index b45a2c95..9a769935 100644 --- a/kopete/plugins/statistics/statisticsdcopiface.h +++ b/kopete/plugins/statistics/statisticsdcopiface.h @@ -29,46 +29,46 @@ k_dcop: /** * Shows the statistics dialog for contact which has KABC id \var contactId */ - virtual void dcopStatisticsDialog(QString contactId) = 0; + virtual void dcopStatisticsDialog(TQString contactId) = 0; /** * \returns true if contact was online at time timeStamp, false else. Returns false if contact does not exist. */ - virtual bool dcopWasOnline(QString id, int timeStamp) = 0; + virtual bool dcopWasOnline(TQString id, int timeStamp) = 0; /** * \returns true if contact was online at dt, false else. Returns false if contact does not exist or if date is invalid. */ - virtual bool dcopWasOnline(QString id, QString datetime) = 0; + virtual bool dcopWasOnline(TQString id, TQString datetime) = 0; /** * \returns true if contact was away at time timeStamp, false else. Returns false if contact does not exist. */ - virtual bool dcopWasAway(QString id, int timeStamp) = 0; + virtual bool dcopWasAway(TQString id, int timeStamp) = 0; /** * \returns true if contact was away at dt, false else. Returns false if contact does not exist or if date is invalid. */ - virtual bool dcopWasAway(QString id, QString datetime) = 0; + virtual bool dcopWasAway(TQString id, TQString datetime) = 0; /** * \returns true if contact was offline at time timeStamp, false else. Returns false if contact does not exist. */ - virtual bool dcopWasOffline(QString id, int timeStamp) = 0; + virtual bool dcopWasOffline(TQString id, int timeStamp) = 0; /** * \returns true if contact was offline at dt, false else. Returns false if contact does not exist or if date is invalid. */ - virtual bool dcopWasOffline(QString id, QString datetime) = 0; + virtual bool dcopWasOffline(TQString id, TQString datetime) = 0; /** * \returns return the status of the contact at datetime. */ - virtual QString dcopStatus(QString id, QString datetime) = 0; + virtual TQString dcopStatus(TQString id, TQString datetime) = 0; /** * \returns return the status of the contact at timeStamp. */ - virtual QString dcopStatus(QString id, int timeStamp) = 0; + virtual TQString dcopStatus(TQString id, int timeStamp) = 0; /** * \returns the main status (most used status) of the contact id at date (not time) timeStamp. Will take the day where timeStamp is. */ - virtual QString dcopMainStatus(QString id, int timeStamp) = 0; + virtual TQString dcopMainStatus(TQString id, int timeStamp) = 0; }; #endif // STATISTICSDCOP_H diff --git a/kopete/plugins/statistics/statisticsdialog.cpp b/kopete/plugins/statistics/statisticsdialog.cpp index 485eb7ad..461dd696 100644 --- a/kopete/plugins/statistics/statisticsdialog.cpp +++ b/kopete/plugins/statistics/statisticsdialog.cpp @@ -14,14 +14,14 @@ */ -#include <qtabwidget.h> -#include <qwidget.h> -#include <qhbox.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qtextedit.h> -#include <qcombobox.h> -#include <qstring.h> +#include <tqtabwidget.h> +#include <tqwidget.h> +#include <tqhbox.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqtextedit.h> +#include <tqcombobox.h> +#include <tqstring.h> #include "kdialogbase.h" #include "klocale.h" @@ -40,7 +40,7 @@ #include "statisticsplugin.h" #include "statisticsdb.h" -StatisticsDialog::StatisticsDialog(StatisticsContact *contact, StatisticsDB *db, QWidget* parent, +StatisticsDialog::StatisticsDialog(StatisticsContact *contact, StatisticsDB *db, TQWidget* parent, const char* name) : KDialogBase(parent, name, false, i18n("Statistics for %1").arg(contact->metaContact()->displayName()), Close, Close), m_db(db), m_contact(contact) { @@ -51,20 +51,20 @@ StatisticsDialog::StatisticsDialog(StatisticsContact *contact, StatisticsDB *db, setMinimumHeight(400); adjustSize(); - QHBox *hbox = new QHBox(this); + TQHBox *hbox = new TQHBox(this); generalHTMLPart = new KHTMLPart(hbox); generalHTMLPart->setOnlyLocalReferences(true); - connect ( generalHTMLPart->browserExtension(), SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ), - this, SLOT( slotOpenURLRequest( const KURL &, const KParts::URLArgs & ) ) ); + connect ( generalHTMLPart->browserExtension(), TQT_SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ), + this, TQT_SLOT( slotOpenURLRequest( const KURL &, const KParts::URLArgs & ) ) ); mainWidget->tabWidget->insertTab(hbox, i18n("General"), 0); mainWidget->tabWidget->setCurrentPage(0); - mainWidget->timePicker->setTime(QTime::currentTime()); - mainWidget->datePicker->setDate(QDate::currentDate()); - connect(mainWidget->askButton, SIGNAL(clicked()), this, SLOT(slotAskButtonClicked())); + mainWidget->timePicker->setTime(TQTime::currentTime()); + mainWidget->datePicker->setDate(TQDate::currentDate()); + connect(mainWidget->askButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotAskButtonClicked())); setFocus(); setEscapeButton(Close); @@ -89,14 +89,14 @@ void StatisticsDialog::slotOpenURLRequest(const KURL& url, const KParts::URLArgs } } -/*void StatisticsDialog::parseTemplate(QString Template) +/*void StatisticsDialog::parseTemplate(TQString Template) { - QString fileString = ::locate("appdata", "kopete_statistics.template.html"); - QString templateString; - QFile file(file); + TQString fileString = ::locate("appdata", "kopete_statistics.template.html"); + TQString templateString; + TQFile file(file); if (file.open(IO_ReadOnly)) { - QTextStream stream(&file); + TQTextStream stream(&file); templateString = stream.read(); file.close(); } @@ -106,14 +106,14 @@ void StatisticsDialog::slotOpenURLRequest(const KURL& url, const KParts::URLArgs void StatisticsDialog::generatePageForMonth(const int monthOfYear) { - QStringList values = m_db->query(QString("SELECT status, datetimebegin, datetimeend " + TQStringList values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend " "FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin;").arg(m_contact->statisticsContactId())); - QStringList values2; + TQStringList values2; for (uint i=0; i<values.count(); i+=3) { - QDateTime dateTimeBegin; + TQDateTime dateTimeBegin; dateTimeBegin.setTime_t(values[i+1].toInt()); /// @todo Same as for Day, check if second datetime is on the same month if (dateTimeBegin.date().month() == monthOfYear) @@ -123,21 +123,21 @@ void StatisticsDialog::generatePageForMonth(const int monthOfYear) values2.push_back(values[i+2]); } } - generatePageFromQStringList(values2, QDate::longMonthName(monthOfYear)); + generatePageFromQStringList(values2, TQDate::longMonthName(monthOfYear)); } void StatisticsDialog::generatePageForDay(const int dayOfWeek) { - QStringList values = m_db->query(QString("SELECT status, datetimebegin, datetimeend " + TQStringList values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend " "FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin;").arg(m_contact->statisticsContactId())); - QStringList values2; + TQStringList values2; for (uint i=0; i<values.count(); i+=3) { - QDateTime dateTimeBegin; + TQDateTime dateTimeBegin; dateTimeBegin.setTime_t(values[i+1].toInt()); - QDateTime dateTimeEnd; + TQDateTime dateTimeEnd; dateTimeEnd.setTime_t(values[i+2].toInt()); if (dateTimeBegin.date().dayOfWeek() == dayOfWeek) { @@ -149,9 +149,9 @@ void StatisticsDialog::generatePageForDay(const int dayOfWeek) // datetime from value[i+1] - dateTimeBegin = QDateTime(dateTimeBegin.date(), QTime(0, 0, 0)); - dateTimeBegin.addSecs(dateTimeBegin.time().secsTo(QTime(23, 59, 59))); - values2.push_back(QString::number(dateTimeBegin.toTime_t())); + dateTimeBegin = TQDateTime(dateTimeBegin.date(), TQTime(0, 0, 0)); + dateTimeBegin.addSecs(dateTimeBegin.time().secsTo(TQTime(23, 59, 59))); + values2.push_back(TQString::number(dateTimeBegin.toTime_t())); } else { @@ -161,15 +161,15 @@ void StatisticsDialog::generatePageForDay(const int dayOfWeek) } } } - generatePageFromQStringList(values2, QDate::longDayName(dayOfWeek)); + generatePageFromQStringList(values2, TQDate::longDayName(dayOfWeek)); } /// @todo chart problem at midnight. -void StatisticsDialog::generatePageFromQStringList(QStringList values, const QString & subTitle) +void StatisticsDialog::generatePageFromQStringList(TQStringList values, const TQString & subTitle) { generalHTMLPart->begin(); - generalHTMLPart->write(QString("<html><head><style>.bar { margin:0px;} " + generalHTMLPart->write(TQString("<html><head><style>.bar { margin:0px;} " "body" "{" "font-size:11px" @@ -223,7 +223,7 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt // mainWidget->listView->addColumn(i18n("Start Date")); // mainWidget->listView->addColumn(i18n("End Date")); - QString todayString; + TQString todayString; todayString.append(i18n("<div class=\"statgroup\" title=\"Contact status history for today\"><h2>Today</h2><table width=\"100%\"><tr><td>Status</td><td>From</td><td>To</td></tr>")); bool today; @@ -259,13 +259,13 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt // it is the STARTDATE from the database - QDateTime dateTime1; + TQDateTime dateTime1; dateTime1.setTime_t(values[i+1].toInt()); // it is the ENDDATE from the database - QDateTime dateTime2; + TQDateTime dateTime2; dateTime2.setTime_t(values[i+2].toInt()); - if (dateTime1.date() == QDate::currentDate() || dateTime2.date() == QDate::currentDate()) + if (dateTime1.date() == TQDate::currentDate() || dateTime2.date() == TQDate::currentDate()) today = true; else today = false; @@ -330,10 +330,10 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt - QString color; + TQString color; if (today) { - QString status; + TQString status; if (Kopete::OnlineStatus::statusStringToType(values[i]) == Kopete::OnlineStatus::Online) { color="blue"; @@ -351,12 +351,12 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt } else color="white"; - todayString.append(QString("<tr style=\"color:%1\"><td>%2</td><td>%3</td><td>%4</td></tr>").arg(color, status, dateTime1.time().toString(), dateTime2.time().toString())); + todayString.append(TQString("<tr style=\"color:%1\"><td>%2</td><td>%3</td><td>%4</td></tr>").arg(color, status, dateTime1.time().toString(), dateTime2.time().toString())); } // We add a listview item to the log list - // QDateTime listViewDT1, listViewDT2; + // TQDateTime listViewDT1, listViewDT2; // listViewDT1.setTime_t(values[i+1].toInt()); // listViewDT2.setTime_t(values[i+2].toInt()); // new KListViewItem(mainWidget->listView, values[i], values[i+1], values[i+2], listViewDT1.toString(), listViewDT2.toString()); @@ -391,83 +391,83 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt "Total online time :</b> %2 hour(s)<br>").arg(m_contact->metaContact()->displayName()).arg(stringFromSeconds(totalOnlineTime))); generalHTMLPart->write(i18n("<b title=\"The total time I have seen %1 away\">Total busy time :</b> %2 hour(s)<br>").arg(m_contact->metaContact()->displayName()).arg(stringFromSeconds(totalAwayTime))); generalHTMLPart->write(i18n("<b title=\"The total time I have seen %1 offline\">Total offline time :</b> %2 hour(s)").arg(m_contact->metaContact()->displayName()).arg(stringFromSeconds(totalOfflineTime))); - generalHTMLPart->write(QString("</div>")); + generalHTMLPart->write(TQString("</div>")); if (subTitle == i18n("General information")) /* * General stats that should not be shown on "day" or "month" pages */ { - generalHTMLPart->write(QString("<div class=\"statgroup\">")); + generalHTMLPart->write(TQString("<div class=\"statgroup\">")); generalHTMLPart->write(i18n("<b>Average message length :</b> %1 characters<br>").arg(m_contact->messageLength())); generalHTMLPart->write(i18n("<b>Time between two messages : </b> %1 second(s)").arg(m_contact->timeBetweenTwoMessages())); - generalHTMLPart->write(QString("</div>")); + generalHTMLPart->write(TQString("</div>")); - generalHTMLPart->write(QString("<div class=\"statgroup\">")); + generalHTMLPart->write(TQString("<div class=\"statgroup\">")); generalHTMLPart->write(i18n("<b title=\"The last time you talked with %1\">Last talk :</b> %2<br>").arg(m_contact->metaContact()->displayName()).arg(KGlobal::locale()->formatDateTime(m_contact->lastTalk()))); generalHTMLPart->write(i18n("<b title=\"The last time I have seen %1 online or away\">Last time contact was present :</b> %2").arg(m_contact->metaContact()->displayName()).arg(KGlobal::locale()->formatDateTime(m_contact->lastPresent()))); - generalHTMLPart->write(QString("</div>")); + generalHTMLPart->write(TQString("</div>")); - //generalHTMLPart->write(QString("<div class=\"statgroup\">")); + //generalHTMLPart->write(TQString("<div class=\"statgroup\">")); //generalHTMLPart->write(i18n("<b title=\"%1 uses to set his status online at these hours (EXPERIMENTAL)\">Main online events :</b><br>").arg(m_contact->metaContact()->displayName())); - //QValueList<QTime> mainEvents = m_contact->mainEvents(Kopete::OnlineStatus::Online); + //TQValueList<TQTime> mainEvents = m_contact->mainEvents(Kopete::OnlineStatus::Online); //for (uint i=0; i<mainEvents.count(); i++) - //generalHTMLPart->write(QString("%1<br>").arg(mainEvents[i].toString())); - //generalHTMLPart->write(QString("</div>")); + //generalHTMLPart->write(TQString("%1<br>").arg(mainEvents[i].toString())); + //generalHTMLPart->write(TQString("</div>")); generalHTMLPart->write("<div title=\"" +i18n("Current status") + "\" class=\"statgroup\">"); generalHTMLPart->write(i18n("Is <b>%1</b> since <b>%2</b>").arg( Kopete::OnlineStatus(m_contact->oldStatus()).description(), KGlobal::locale()->formatDateTime(m_contact->oldStatusDateTime()))); - generalHTMLPart->write(QString("</div>")); + generalHTMLPart->write(TQString("</div>")); } /* * Chart which show the hours where plugin has seen this contact online */ - generalHTMLPart->write(QString("<div class=\"statgroup\">")); - generalHTMLPart->write(QString("<table width=\"100%\"><tr><td colspan=\"3\">") + i18n("When have I seen this contact ?") + QString("</td></tr>")); - generalHTMLPart->write(QString("<tr><td height=\"200\" valign=\"bottom\" colspan=\"3\" class=\"chart\">")); + generalHTMLPart->write(TQString("<div class=\"statgroup\">")); + generalHTMLPart->write(TQString("<table width=\"100%\"><tr><td colspan=\"3\">") + i18n("When have I seen this contact ?") + TQString("</td></tr>")); + generalHTMLPart->write(TQString("<tr><td height=\"200\" valign=\"bottom\" colspan=\"3\" class=\"chart\">")); - QString chartString; - QString colorPath = ::locate("appdata", "pics/statistics/black.png"); + TQString chartString; + TQString colorPath = ::locate("appdata", "pics/statistics/black.png"); for (uint i=0; i<24; i++) { int hrWidth = qRound((double)hours[i]/(double)hours[iMaxHours]*100.); - chartString += QString("<img class=\"margin:0px;\" height=\"") - +(totalTime ? QString::number(hrWidth) : QString::number(0)) - +QString("\" src=\"file://") + chartString += TQString("<img class=\"margin:0px;\" height=\"") + +(totalTime ? TQString::number(hrWidth) : TQString::number(0)) + +TQString("\" src=\"file://") +colorPath +"\" width=\"4%\" title=\"" +i18n("Between %1:00 and %2:00, I was able to see %3 status %4% of the hour.").arg(i).arg((i+1)%24).arg(m_contact->metaContact()->displayName()).arg(hrWidth) - +QString("\">"); + +TQString("\">"); } generalHTMLPart->write(chartString); - generalHTMLPart->write(QString("</td></tr>")); + generalHTMLPart->write(TQString("</td></tr>")); - generalHTMLPart->write(QString( "<tr>" - "<td>")+i18n("Online time")+QString("</td><td>")+i18n("Away time")+QString("</td><td>")+i18n("Offline time")+QString("</td>" + generalHTMLPart->write(TQString( "<tr>" + "<td>")+i18n("Online time")+TQString("</td><td>")+i18n("Away time")+TQString("</td><td>")+i18n("Offline time")+TQString("</td>" "</tr>" "<td valign=\"bottom\" width=\"33%\" class=\"chart\">")); generalHTMLPart->write(generateHTMLChart(hoursOnline, hoursAway, hoursOffline, i18n("online"), "blue")); - generalHTMLPart->write(QString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">")); + generalHTMLPart->write(TQString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">")); generalHTMLPart->write(generateHTMLChart(hoursAway, hoursOnline, hoursOffline, i18n("away"), "navy")); - generalHTMLPart->write(QString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">")); + generalHTMLPart->write(TQString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">")); generalHTMLPart->write(generateHTMLChart(hoursOffline, hoursAway, hoursOnline, i18n("offline"), "gray")); - generalHTMLPart->write(QString("</td></tr></table></div>")); + generalHTMLPart->write(TQString("</td></tr></table></div>")); if (subTitle == i18n("General information")) /* On main page, show the different status of the contact today */ { - generalHTMLPart->write(QString(todayString)); + generalHTMLPart->write(TQString(todayString)); } - generalHTMLPart->write(QString("</body></html>")); + generalHTMLPart->write(TQString("</body></html>")); generalHTMLPart->end(); @@ -475,18 +475,18 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt void StatisticsDialog::generatePageGeneral() { - QStringList values; - values = m_db->query(QString("SELECT status, datetimebegin, datetimeend " + TQStringList values; + values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend " "FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin;") .arg(m_contact->statisticsContactId())); generatePageFromQStringList(values, i18n("General information")); } -QString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2, const int *hours3, const QString & caption, const QString & color) +TQString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2, const int *hours3, const TQString & caption, const TQString & color) { - QString chartString; + TQString chartString; - QString colorPath = ::locate("appdata", "pics/statistics/"+color+".png"); + TQString colorPath = ::locate("appdata", "pics/statistics/"+color+".png"); for (uint i=0; i<24; i++) @@ -494,9 +494,9 @@ QString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2, int totalTime = hours[i] + hours2[i] + hours3[i]; int hrWidth = qRound((double)hours[i]/(double)totalTime*100.); - chartString += QString("<img class=\"margin:0px;\" height=\"") - +(totalTime ? QString::number(hrWidth) : QString::number(0)) - +QString("\" src=\"file://") + chartString += TQString("<img class=\"margin:0px;\" height=\"") + +(totalTime ? TQString::number(hrWidth) : TQString::number(0)) + +TQString("\" src=\"file://") +colorPath +"\" width=\"4%\" title=\""+ i18n("Between %1:00 and %2:00, I have seen %3 %4% %5."). @@ -510,23 +510,23 @@ QString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2, return chartString; } -QString StatisticsDialog::stringFromSeconds(const int seconds) +TQString StatisticsDialog::stringFromSeconds(const int seconds) { int h, m, s; h = seconds/3600; m = (seconds % 3600)/60; s = (seconds % 3600) % 60; - return QString::number(h)+":"+QString::number(m)+":"+QString::number(s); + return TQString::number(h)+":"+TQString::number(m)+":"+TQString::number(s); } void StatisticsDialog::slotAskButtonClicked() { if (mainWidget->questionComboBox->currentItem()==0) { - QString text = i18n("1 is date, 2 is contact name, 3 is online status", "%1, %2 was %3") - .arg(KGlobal::locale()->formatDateTime(QDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time()))) + TQString text = i18n("1 is date, 2 is contact name, 3 is online status", "%1, %2 was %3") + .arg(KGlobal::locale()->formatDateTime(TQDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time()))) .arg(m_contact->metaContact()->displayName()) - .arg(m_contact->statusAt(QDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time()))); + .arg(m_contact->statusAt(TQDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time()))); mainWidget->answerEdit->setText(text); } else if (mainWidget->questionComboBox->currentItem()==1) diff --git a/kopete/plugins/statistics/statisticsdialog.h b/kopete/plugins/statistics/statisticsdialog.h index 32a5aaaf..294ec2a8 100644 --- a/kopete/plugins/statistics/statisticsdialog.h +++ b/kopete/plugins/statistics/statisticsdialog.h @@ -16,7 +16,7 @@ #ifndef _STATISTICSDIALOG_H #define _STATISTICSDIALOG_H -#include <qwidget.h> +#include <tqwidget.h> #include <kdialogbase.h> #include "kopetemetacontact.h" @@ -40,12 +40,12 @@ class StatisticsDialog : public KDialogBase { Q_OBJECT public: - StatisticsDialog(StatisticsContact *contact, StatisticsDB* db, QWidget* parent=0, + StatisticsDialog(StatisticsContact *contact, StatisticsDB* db, TQWidget* parent=0, const char* name="StatisticsDialog"); private: - QString generateHTMLChart(const int *hours, const int *hours2, const int *hours3, const QString & caption, const QString & color); - QString generateHTMLChartBar(int height, const QString & color, const QString & caption); - QString stringFromSeconds(const int seconds); + TQString generateHTMLChart(const int *hours, const int *hours2, const int *hours3, const TQString & caption, const TQString & color); + TQString generateHTMLChartBar(int height, const TQString & color, const TQString & caption); + TQString stringFromSeconds(const int seconds); StatisticsWidget *mainWidget; KHTMLPart *generalHTMLPart; @@ -55,7 +55,7 @@ class StatisticsDialog : public KDialogBase /// Metacontact for which we get the statistics from m_db StatisticsContact *m_contact; - void generatePageFromQStringList(QStringList values, const QString & subTitle); + void generatePageFromQStringList(TQStringList values, const TQString & subTitle); /// Generates the main page void generatePageGeneral(); diff --git a/kopete/plugins/statistics/statisticsplugin.cpp b/kopete/plugins/statistics/statisticsplugin.cpp index f0d190b3..bef49af8 100644 --- a/kopete/plugins/statistics/statisticsplugin.cpp +++ b/kopete/plugins/statistics/statisticsplugin.cpp @@ -14,9 +14,9 @@ ************************************************************************* */ -#include <qfile.h> -#include <qdict.h> -#include <qtimer.h> +#include <tqfile.h> +#include <tqdict.h> +#include <tqtimer.h> #include <kgenericfactory.h> #include <kaboutdata.h> @@ -46,34 +46,34 @@ typedef KGenericFactory<StatisticsPlugin> StatisticsPluginFactory; static const KAboutData aboutdata("kopete_statistics", I18N_NOOP("Statistics") , "0.1" ); K_EXPORT_COMPONENT_FACTORY( kopete_statistics, StatisticsPluginFactory( &aboutdata ) ) -StatisticsPlugin::StatisticsPlugin( QObject *parent, const char *name, const QStringList &) +StatisticsPlugin::StatisticsPlugin( TQObject *parent, const char *name, const TQStringList &) : DCOPObject("StatisticsDCOPIface"), Kopete::Plugin( StatisticsPluginFactory::instance(), parent, name ) { KAction *viewMetaContactStatistics = new KAction( i18n("View &Statistics" ), - QString::fromLatin1( "log" ), 0, this, SLOT(slotViewStatistics()), + TQString::fromLatin1( "log" ), 0, this, TQT_SLOT(slotViewStatistics()), actionCollection(), "viewMetaContactStatistics" ); viewMetaContactStatistics->setEnabled(Kopete::ContactList::self()->selectedMetaContacts().count() == 1); - connect(Kopete::ChatSessionManager::self(),SIGNAL(chatSessionCreated(Kopete::ChatSession*)), - this, SLOT(slotViewCreated(Kopete::ChatSession*))); - connect(Kopete::ChatSessionManager::self(),SIGNAL(aboutToReceive(Kopete::Message&)), - this, SLOT(slotAboutToReceive(Kopete::Message&))); + connect(Kopete::ChatSessionManager::self(),TQT_SIGNAL(chatSessionCreated(Kopete::ChatSession*)), + this, TQT_SLOT(slotViewCreated(Kopete::ChatSession*))); + connect(Kopete::ChatSessionManager::self(),TQT_SIGNAL(aboutToReceive(Kopete::Message&)), + this, TQT_SLOT(slotAboutToReceive(Kopete::Message&))); - connect(Kopete::ContactList::self(), SIGNAL(metaContactSelected(bool)), - viewMetaContactStatistics, SLOT(setEnabled(bool))); - connect(Kopete::ContactList::self(), SIGNAL(metaContactAdded(Kopete::MetaContact*)), - this, SLOT(slotMetaContactAdded(Kopete::MetaContact*))); - connect(Kopete::ContactList::self(), SIGNAL(metaContactRemoved(Kopete::MetaContact*)), - this, SLOT(slotMetaContactRemoved(Kopete::MetaContact*))); + connect(Kopete::ContactList::self(), TQT_SIGNAL(metaContactSelected(bool)), + viewMetaContactStatistics, TQT_SLOT(setEnabled(bool))); + connect(Kopete::ContactList::self(), TQT_SIGNAL(metaContactAdded(Kopete::MetaContact*)), + this, TQT_SLOT(slotMetaContactAdded(Kopete::MetaContact*))); + connect(Kopete::ContactList::self(), TQT_SIGNAL(metaContactRemoved(Kopete::MetaContact*)), + this, TQT_SLOT(slotMetaContactRemoved(Kopete::MetaContact*))); setXMLFile("statisticsui.rc"); /* Initialization reads the database, so it could be a bit time-consuming due to disk access. This should overcome the problem and makes it non-blocking. */ - QTimer::singleShot(0, this, SLOT(slotInitialize())); + TQTimer::singleShot(0, this, TQT_SLOT(slotInitialize())); } void StatisticsPlugin::slotInitialize() @@ -81,8 +81,8 @@ void StatisticsPlugin::slotInitialize() // Initializes the database m_db = new StatisticsDB(); - QPtrList<Kopete::MetaContact> list = Kopete::ContactList::self()->metaContacts(); - QPtrListIterator<Kopete::MetaContact> it( list ); + TQPtrList<Kopete::MetaContact> list = Kopete::ContactList::self()->metaContacts(); + TQPtrListIterator<Kopete::MetaContact> it( list ); for (; it.current(); ++it) { slotMetaContactAdded(it.current()); @@ -91,7 +91,7 @@ void StatisticsPlugin::slotInitialize() StatisticsPlugin::~StatisticsPlugin() { - QMap<Kopete::MetaContact*, StatisticsContact*>::Iterator it; + TQMap<Kopete::MetaContact*, StatisticsContact*>::Iterator it; for ( it = statisticsMetaContactMap.begin(); it != statisticsMetaContactMap.end(); ++it ) { delete it.data(); @@ -107,13 +107,13 @@ void StatisticsPlugin::slotAboutToReceive(Kopete::Message& m) void StatisticsPlugin::slotViewCreated(Kopete::ChatSession* session) { - connect(session, SIGNAL(closing(Kopete::ChatSession*)), this, SLOT(slotViewClosed(Kopete::ChatSession*))); + connect(session, TQT_SIGNAL(closing(Kopete::ChatSession*)), this, TQT_SLOT(slotViewClosed(Kopete::ChatSession*))); } void StatisticsPlugin::slotViewClosed(Kopete::ChatSession* session) { - QPtrList<Kopete::Contact> list = session->members(); - QPtrListIterator<Kopete::Contact> it( list ); + TQPtrList<Kopete::Contact> list = session->members(); + TQPtrListIterator<Kopete::Contact> it( list ); for (; it.current(); ++it) { @@ -145,7 +145,7 @@ void StatisticsPlugin::slotMetaContactAdded(Kopete::MetaContact *mc) { statisticsMetaContactMap[mc] = new StatisticsContact(mc, db()); - QPtrList<Kopete::Contact> clist = mc->contacts(); + TQPtrList<Kopete::Contact> clist = mc->contacts(); Kopete::Contact *contact; // we need to call slotContactAdded if MetaContact allready have contacts @@ -154,12 +154,12 @@ void StatisticsPlugin::slotMetaContactAdded(Kopete::MetaContact *mc) this->slotContactAdded(contact); } - connect(mc, SIGNAL(onlineStatusChanged( Kopete::MetaContact *, Kopete::OnlineStatus::StatusType)), this, - SLOT(slotOnlineStatusChanged(Kopete::MetaContact*, Kopete::OnlineStatus::StatusType))); - connect(mc, SIGNAL(contactAdded( Kopete::Contact *)), this, - SLOT(slotContactAdded( Kopete::Contact *))); - connect(mc, SIGNAL(contactRemoved( Kopete::Contact *)), this, - SLOT(slotContactRemoved( Kopete::Contact *))); + connect(mc, TQT_SIGNAL(onlineStatusChanged( Kopete::MetaContact *, Kopete::OnlineStatus::StatusType)), this, + TQT_SLOT(slotOnlineStatusChanged(Kopete::MetaContact*, Kopete::OnlineStatus::StatusType))); + connect(mc, TQT_SIGNAL(contactAdded( Kopete::Contact *)), this, + TQT_SLOT(slotContactAdded( Kopete::Contact *))); + connect(mc, TQT_SIGNAL(contactRemoved( Kopete::Contact *)), this, + TQT_SLOT(slotContactRemoved( Kopete::Contact *))); } void StatisticsPlugin::slotMetaContactRemoved(Kopete::MetaContact *mc) @@ -191,7 +191,7 @@ void StatisticsPlugin::slotContactRemoved( Kopete::Contact *c) statisticsContactMap.remove(c->contactId()); } -void StatisticsPlugin::dcopStatisticsDialog(QString id) +void StatisticsPlugin::dcopStatisticsDialog(TQString id) { kdDebug() << k_funcinfo << "statistics - DCOP dialog :" << id << endl; @@ -201,43 +201,43 @@ void StatisticsPlugin::dcopStatisticsDialog(QString id) } } -bool StatisticsPlugin::dcopWasOnline(QString id, int timeStamp) +bool StatisticsPlugin::dcopWasOnline(TQString id, int timeStamp) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(timeStamp); return dcopWasStatus(id, dt, Kopete::OnlineStatus::Online); } -bool StatisticsPlugin::dcopWasOnline(QString id, QString dateTime) +bool StatisticsPlugin::dcopWasOnline(TQString id, TQString dateTime) { - return dcopWasStatus(id, QDateTime::fromString(dateTime), Kopete::OnlineStatus::Online); + return dcopWasStatus(id, TQDateTime::fromString(dateTime), Kopete::OnlineStatus::Online); } -bool StatisticsPlugin::dcopWasAway(QString id, int timeStamp) +bool StatisticsPlugin::dcopWasAway(TQString id, int timeStamp) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(timeStamp); return dcopWasStatus(id, dt, Kopete::OnlineStatus::Away); } -bool StatisticsPlugin::dcopWasAway(QString id, QString dateTime) +bool StatisticsPlugin::dcopWasAway(TQString id, TQString dateTime) { - return dcopWasStatus(id, QDateTime::fromString(dateTime), Kopete::OnlineStatus::Away); + return dcopWasStatus(id, TQDateTime::fromString(dateTime), Kopete::OnlineStatus::Away); } -bool StatisticsPlugin::dcopWasOffline(QString id, int timeStamp) +bool StatisticsPlugin::dcopWasOffline(TQString id, int timeStamp) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(timeStamp); return dcopWasStatus(id, dt, Kopete::OnlineStatus::Offline); } -bool StatisticsPlugin::dcopWasOffline(QString id, QString dateTime) +bool StatisticsPlugin::dcopWasOffline(TQString id, TQString dateTime) { - return dcopWasStatus(id, QDateTime::fromString(dateTime), Kopete::OnlineStatus::Offline); + return dcopWasStatus(id, TQDateTime::fromString(dateTime), Kopete::OnlineStatus::Offline); } -bool StatisticsPlugin::dcopWasStatus(QString id, QDateTime dateTime, Kopete::OnlineStatus::StatusType status) +bool StatisticsPlugin::dcopWasStatus(TQString id, TQDateTime dateTime, Kopete::OnlineStatus::StatusType status) { kdDebug() << k_funcinfo << "statistics - DCOP wasOnline :" << id << endl; @@ -249,17 +249,17 @@ bool StatisticsPlugin::dcopWasStatus(QString id, QDateTime dateTime, Kopete::Onl return false; } -QString StatisticsPlugin::dcopStatus(QString id, int timeStamp) +TQString StatisticsPlugin::dcopStatus(TQString id, int timeStamp) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(timeStamp); return dcopStatus(id, dt.toString()); } -QString StatisticsPlugin::dcopStatus(QString id, QString dateTime) +TQString StatisticsPlugin::dcopStatus(TQString id, TQString dateTime) { - QDateTime dt = QDateTime::fromString(dateTime); + TQDateTime dt = TQDateTime::fromString(dateTime); if (dt.isValid() && statisticsContactMap.contains(id)) { @@ -269,9 +269,9 @@ QString StatisticsPlugin::dcopStatus(QString id, QString dateTime) return ""; } -QString StatisticsPlugin::dcopMainStatus(QString id, int timeStamp) +TQString StatisticsPlugin::dcopMainStatus(TQString id, int timeStamp) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(timeStamp); if (dt.isValid() && statisticsContactMap.contains(id)) { diff --git a/kopete/plugins/statistics/statisticsplugin.h b/kopete/plugins/statistics/statisticsplugin.h index d757b424..1492cd41 100644 --- a/kopete/plugins/statistics/statisticsplugin.h +++ b/kopete/plugins/statistics/statisticsplugin.h @@ -17,10 +17,10 @@ #ifndef STATISTICSPLUGIN_H #define STATISTICSPLUGIN_H -#include <qobject.h> -#include <qmap.h> -#include <qstring.h> -#include <qstringlist.h> +#include <tqobject.h> +#include <tqmap.h> +#include <tqstring.h> +#include <tqstringlist.h> #include <dcopobject.h> @@ -101,7 +101,7 @@ class StatisticsPlugin : public Kopete::Plugin, virtual public StatisticsDCOPIfa Q_OBJECT public: /// Standard plugin constructors - StatisticsPlugin(QObject *parent, const char *name, const QStringList &args); + StatisticsPlugin(TQObject *parent, const char *name, const TQStringList &args); ~StatisticsPlugin(); /// Method to access m_db member @@ -179,34 +179,34 @@ public slots: * DCOP functions * See statisticsdcopiface.h for the documentation */ - void dcopStatisticsDialog(QString id); + void dcopStatisticsDialog(TQString id); - bool dcopWasOnline(QString id, int timeStamp); - bool dcopWasOnline(QString id, QString dt); + bool dcopWasOnline(TQString id, int timeStamp); + bool dcopWasOnline(TQString id, TQString dt); - bool dcopWasAway(QString id, int timeStamp); - bool dcopWasAway(QString id, QString dt); + bool dcopWasAway(TQString id, int timeStamp); + bool dcopWasAway(TQString id, TQString dt); - bool dcopWasOffline(QString id, int timeStamp); - bool dcopWasOffline(QString id, QString dt); + bool dcopWasOffline(TQString id, int timeStamp); + bool dcopWasOffline(TQString id, TQString dt); - bool dcopWasStatus(QString id, QDateTime dateTime, Kopete::OnlineStatus::StatusType status); + bool dcopWasStatus(TQString id, TQDateTime dateTime, Kopete::OnlineStatus::StatusType status); - QString dcopStatus(QString id, QString dateTime); - QString dcopStatus(QString id, int timeStamp); + TQString dcopStatus(TQString id, TQString dateTime); + TQString dcopStatus(TQString id, int timeStamp); - QString dcopMainStatus(QString id, int timeStamp); + TQString dcopMainStatus(TQString id, int timeStamp); private: StatisticsDB *m_db; /** Associate a Kopete::Contact id to a StatisticsContact to retrieve * the StatisticsContact corresponding to the Kopete::Contact */ - QMap<QString, StatisticsContact*> statisticsContactMap; + TQMap<TQString, StatisticsContact*> statisticsContactMap; /** Associate a Kopete::MetaContact to a StatisticsContact to retrieve * the StatisticsContact corresponding to the MetaContact */ - QMap<Kopete::MetaContact*, StatisticsContact*> statisticsMetaContactMap; + TQMap<Kopete::MetaContact*, StatisticsContact*> statisticsMetaContactMap; }; |