File indexing completed on 2023-12-03 05:01:58
0001 /* 0002 * Copyright (C) 2012 Dan Vrátil <dvratil@redhat.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0017 */ 0018 0019 #ifndef LOGSIMPORTER_H 0020 #define LOGSIMPORTER_H 0021 0022 #include <QtCore/QObject> 0023 #include <TelepathyQt/Types> 0024 0025 #include <KTp/ktpcommoninternals_export.h> 0026 0027 namespace KTp 0028 { 0029 0030 /** 0031 * @short A class to import old logs from Kopete 0032 * 0033 * This class provides convenient interface for importing logs from Kopete. 0034 * 0035 * Currently the importer supports AIM, WML, ICQ, Jabber, GaduGadu and Yahoo logs. 0036 */ 0037 class KTPCOMMONINTERNALS_EXPORT LogsImporter : public QObject 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 LogsImporter(QObject *parent = nullptr); 0043 0044 ~LogsImporter() override; 0045 0046 /** 0047 * Checks whether there are any Kopete logs for \p account. 0048 * 0049 * @param account Telepathy Account against whose Kopete counterpart to check 0050 * @return Returns when there is at least one log for given account 0051 */ 0052 bool hasKopeteLogs(const Tp::AccountPtr &account); 0053 0054 /** 0055 * Imports Kopete logs for \p account to Telepathy 0056 * 0057 * Finds all Kopete logs for Kopete-version of \p account, converts them 0058 * to Telepathy Logger format and imports then to Telepathy Logger storage. 0059 * 0060 * This method returns immediatelly. When all logs are scanned and converted, 0061 * logsImported() signal is emitted. 0062 * 0063 * The import will NOT overwrite existing log files. 0064 * 0065 * @param account A Telepathy Account 0066 */ 0067 void startLogImport(const Tp::AccountPtr &account); 0068 0069 Q_SIGNALS: 0070 /** 0071 * Emitted when logs are successfully imported. 0072 */ 0073 void logsImported(); 0074 0075 /** 0076 * Emitted when an error occurs during importing. 0077 * 0078 * The process can still import some logs, but some might be missing. 0079 */ 0080 void error(const QString &error); 0081 0082 private: 0083 class Private; 0084 Private *d; 0085 }; 0086 0087 } /* namespace KTp */ 0088 0089 #endif // LOGSIMPORTER_H