Changeset View
Changeset View
Standalone View
Standalone View
plugins/history/historylogger.cpp
Context not available. | |||||
68 | m_filterRegExp = false; | 68 | m_filterRegExp = false; | ||
---|---|---|---|---|---|
69 | 69 | | |||
70 | //the contact may be destroyed, for example, if the contact changes its metacontact | 70 | //the contact may be destroyed, for example, if the contact changes its metacontact | ||
71 | connect(m_metaContact, SIGNAL(destroyed(QObject *)), this, SLOT(slotMCDeleted())); | 71 | connect(m_metaContact, &Kopete::MetaContact::destroyed, this, &HistoryLogger::slotMCDeleted); | ||
72 | 72 | | |||
73 | setPositionToLast(); | 73 | setPositionToLast(); | ||
74 | } | 74 | } | ||
Context not available. | |||||
87 | m_filterRegExp = false; | 87 | m_filterRegExp = false; | ||
88 | 88 | | |||
89 | //the contact may be destroyed, for example, if the contact changes its metacontact | 89 | //the contact may be destroyed, for example, if the contact changes its metacontact | ||
90 | connect(m_metaContact, SIGNAL(destroyed(QObject *)), this, SLOT(slotMCDeleted())); | 90 | connect(m_metaContact, &Kopete::MetaContact::destroyed, this, &HistoryLogger::slotMCDeleted); | ||
91 | 91 | | |||
92 | setPositionToLast(); | 92 | setPositionToLast(); | ||
93 | } | 93 | } | ||
Context not available. | |||||
326 | 326 | | |||
327 | if (!m_saveTimer) { | 327 | if (!m_saveTimer) { | ||
328 | m_saveTimer = new QTimer(this); | 328 | m_saveTimer = new QTimer(this); | ||
329 | connect(m_saveTimer, SIGNAL(timeout()), this, SLOT(saveToDisk())); | 329 | connect(m_saveTimer, &QTimer::timeout, this, &HistoryLogger::saveToDisk); | ||
330 | } | 330 | } | ||
331 | if (!m_saveTimer->isActive()) { | 331 | if (!m_saveTimer->isActive()) { | ||
332 | m_saveTimer->setSingleShot(true); | 332 | m_saveTimer->setSingleShot(true); | ||
Context not available. | |||||
688 | 688 | | |||
689 | QString HistoryLogger::getFileName(const Kopete::Contact *c, QDate date) | 689 | QString HistoryLogger::getFileName(const Kopete::Contact *c, QDate date) | ||
690 | { | 690 | { | ||
691 | QString name = c->protocol()->pluginId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-")) | 691 | QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); | ||
692 | +QString::fromLatin1("/") | 692 | QString directoryToLog = QString::fromLatin1("/logs/") | ||
693 | +c->account()->accountId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-")) | 693 | + c->protocol()->pluginId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-")) | ||
694 | +QString::fromLatin1("/") | 694 | + QString::fromLatin1("/") | ||
695 | +c->contactId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-")) | 695 | + c->account()->accountId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-")) | ||
696 | + QString::fromLatin1("/"); | ||||
697 | | ||||
698 | // Create Directory to store History Log if It does not exist | ||||
699 | QDir dir(directoryToLog); | ||||
700 | if (!dir.exists()) { | ||||
701 | dir.mkpath(dataLocation); | ||||
702 | } | ||||
703 | QString name = c->contactId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-")) | ||||
696 | +date.toString(".yyyyMM"); | 704 | +date.toString(".yyyyMM"); | ||
697 | 705 | | |||
698 | QString filename = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QString::fromLatin1("kopete/logs/") + name+ QString::fromLatin1(".xml"); | 706 | QString filename = dataLocation + directoryToLog + name + QString::fromLatin1(".xml"); | ||
699 | 707 | | |||
700 | //Check if there is a kopete 0.7.x file | 708 | //Check if there is a kopete 0.7.x file | ||
701 | QFileInfo fi(filename); | 709 | QFileInfo fi(filename); | ||
Context not available. |