diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,6 +38,7 @@ clientpidmap.cpp ${vcardparser_SRCS} kcontacts.qrc + improtocols/improtocols.qrc ) set(kcontacts_converter_SRCS @@ -112,7 +113,6 @@ add_subdirectory(converter) add_subdirectory(generator) -add_subdirectory(improtocols) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kcontacts_export.h diff --git a/src/impp.cpp b/src/impp.cpp --- a/src/impp.cpp +++ b/src/impp.cpp @@ -174,24 +174,34 @@ return s; } -QString Impp::serviceLabel(const QString &serviceType) +static QString improtcolFile(const QString &serviceType) { const auto path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/kcontacts/improtocols/") + serviceType + QStringLiteral(".desktop")); + if (!path.isEmpty()) { + return path; + } + return QStringLiteral(":/org.kde.kcontacts/improtocols/") + serviceType + QStringLiteral(".desktop"); +} + +QString Impp::serviceLabel(const QString &serviceType) +{ + const auto path = improtcolFile(serviceType); KDesktopFile df(path); return df.readName(); } QString Impp::serviceIcon(const QString &serviceType) { - const auto path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/kcontacts/improtocols/") + serviceType + QStringLiteral(".desktop")); + const auto path = improtcolFile(serviceType); KDesktopFile df(path); return df.readIcon(); } QVector Impp::serviceTypes() { QVector types; - const auto paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/kcontacts/improtocols"), QStandardPaths::LocateDirectory); + auto paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/kcontacts/improtocols"), QStandardPaths::LocateDirectory); + paths.push_back(QStringLiteral(":/org.kde.kcontacts/improtocols/")); for (const auto &path : paths) { QDirIterator it(path, QDir::Files); while (it.hasNext()) { diff --git a/src/improtocols/CMakeLists.txt b/src/improtocols/CMakeLists.txt deleted file mode 100644 --- a/src/improtocols/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -install(FILES - aim.desktop - facebook.desktop - gg.desktop - googletalk.desktop - groupwise.desktop - icq.desktop - irc.desktop - meanwhile.desktop - msn.desktop - qq.desktop - sip.desktop - skype.desktop - sms.desktop - twitter.desktop - xmpp.desktop - ymsgr.desktop - DESTINATION ${KDE_INSTALL_DATADIR_KF5}/kcontacts/improtocols -) diff --git a/src/improtocols/improtocols.qrc b/src/improtocols/improtocols.qrc new file mode 100644 --- /dev/null +++ b/src/improtocols/improtocols.qrc @@ -0,0 +1,20 @@ + + + aim.desktop + facebook.desktop + gg.desktop + googletalk.desktop + groupwise.desktop + icq.desktop + irc.desktop + meanwhile.desktop + msn.desktop + qq.desktop + sip.desktop + skype.desktop + sms.desktop + twitter.desktop + xmpp.desktop + ymsgr.desktop + +