Codebase list ktp-accounts-kcm / 6b05a5f
Port to KTp Logger Dan Vrátil 10 years ago
4 changed file(s) with 6 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
1010 set(KDE_MIN_VERSION "4.7.0")
1111 find_package (KDE4 REQUIRED)
1212 find_package (TelepathyQt4 0.8.9 REQUIRED)
13 find_package (TelepathyLoggerQt4 QUIET)
1413 find_package (KTp REQUIRED)
15
16 macro_log_feature(TELEPATHY_LOGGER_QT4_FOUND "TelepatyLoggerQt4" "Qt bindings for TelepathyLogger. This is needed to provide access to chat logs. HIGHLY recommended" "http://projects.kde.org/telepathy-logger-qt" FALSE "" "")
17 macro_display_feature_log()
1814
1915 # set some default settings
2016 include (KDE4Defaults)
3329 ${CMAKE_CURRENT_SOURCE_DIR}/src
3430 )
3531
36 if (TELEPATHY_LOGGER_QT4_FOUND)
37 add_definitions(${TELEPATHY_LOGGER_QT4_DEFINITIONS} -DHAVE_TPLOGGERQT)
38 include_directories(${TELEPATHY_LOGGER_QT4_INCLUDE_DIRS})
39 endif (TELEPATHY_LOGGER_QT4_FOUND)
40
4132 add_subdirectory (src)
4233 add_subdirectory (data)
4334 add_subdirectory (plugins)
33 # KTP_LIBRARIES
44 # KTP_MODELS_LIBRARIES
55 # KTP_WIDGETS_LIBRARIES
6 # KTP_LOGGER_LIBRARIES
67
78 # Copyright (c) 2011, Dario Freddi <drf@kde.org>
89 #
2728 find_library(KTP_LIBRARIES NAMES ktpcommoninternalsprivate )
2829 find_library(KTP_MODELS_LIBRARIES NAMES ktpmodelsprivate )
2930 find_library(KTP_WIDGETS_LIBRARIES NAMES ktpwidgetsprivate )
31 find_library(KTP_LOGGER_LIBRARIES NAMES ktploggerprivate )
3032
3133 include(FindPackageHandleStandardArgs)
3234 FIND_PACKAGE_HANDLE_STANDARD_ARGS(KTp DEFAULT_MSG
3838 ${TELEPATHY_QT4_LIBRARIES}
3939 ${KTP_LIBRARIES}
4040 ${KTP_MODELS_LIBRARIES}
41 ${KTP_LOGGER_LIBRARIES}
4142 ${KDE4_KIO_LIBS}
42 ${TELEPATHY_LOGGER_QT4_LIBRARIES}
4343 )
4444
4545 # Install:
5959 #include <TelepathyQt/PendingComposite>
6060 #include <TelepathyQt/ConnectionManager>
6161
62 #ifdef HAVE_TPLOGGERQT
63 #include <TelepathyLoggerQt4/LogManager>
64 #include <TelepathyLoggerQt4/Init>
65 #include <TelepathyLoggerQt4/PendingOperation>
66 #endif
62 #include <KTp/Logger/log-manager.h>
6763
6864 K_PLUGIN_FACTORY(KCMTelepathyAccountsFactory, registerPlugin<KCMTelepathyAccounts>();)
6965 K_EXPORT_PLUGIN(KCMTelepathyAccountsFactory("kcm_ktp_accounts", "kcm_ktp_accounts"))
9086
9187 // The first thing we must do is register Telepathy DBus Types.
9288 Tp::registerTypes();
93 #ifdef HAVE_TPLOGGERQT
94 Tpl::init();
95 #endif
9689
9790 // Start setting up the Telepathy AccountManager.
9891 Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
412405 dialog->setButtonGuiItem(KDialog::Yes, KGuiItem(i18n("Remove Account"), QLatin1String("edit-delete")));
413406 bool removeLogs = false;
414407
415 // Don't show the 'Remove logs' checkbox when we don't support TpLogger
416 #ifdef HAVE_TPLOGGERQT
417408 const QString msg = i18n("Remove conversations logs");
418 #else
419 const QString msg;
420 #endif
421
422409 if (KMessageBox::createKMessageBox(dialog, QMessageBox::Warning, i18n("Are you sure you want to remove the account \"%1\"?", accountName),
423410 QStringList(), msg , &removeLogs,
424411 KMessageBox::Dangerous | KMessageBox::Notify) == KDialog::Yes) {
428415 return;
429416 }
430417
431 #ifdef HAVE_TPLOGGERQT
432418 if (removeLogs) {
433 Tpl::LogManagerPtr logManager = Tpl::LogManager::instance();
434 logManager->clearAccountHistory(account);
419 KTp::LogManager *logManager = KTp::LogManager::instance();
420 logManager->clearAccountLogs(account);
435421 }
436 #endif
437422
438423 QList<Tp::PendingOperation*> ops;
439424 ops.append(KTp::WalletUtils::removeAccountPassword(account));