[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:25:09 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=21cbbc7
The following commit has been merged in the master branch:
commit 21cbbc7fefdd762de60cb251566ba47583d98cf3
Author: Martin Klapetek <mklapetek at kde.org>
Date: Tue Jan 13 17:12:35 2015 +0100
[adiumxtra] Port to KF5
---
adiumxtra-protocol-handler/CMakeLists.txt | 1 -
.../adiumxtra-protocol-handler.cpp | 44 ++++++++++------------
.../adiumxtra-protocol-handler.h | 2 +-
adiumxtra-protocol-handler/bundle-installer.cpp | 2 -
.../chat-style-installer.cpp | 40 +++++---------------
adiumxtra-protocol-handler/chat-style-installer.h | 8 ++--
.../emoticon-set-installer.cpp | 27 ++-----------
.../emoticon-set-installer.h | 6 +--
adiumxtra-protocol-handler/main.cpp | 40 +++++++++++---------
9 files changed, 61 insertions(+), 109 deletions(-)
diff --git a/adiumxtra-protocol-handler/CMakeLists.txt b/adiumxtra-protocol-handler/CMakeLists.txt
index de72318..f78a62f 100644
--- a/adiumxtra-protocol-handler/CMakeLists.txt
+++ b/adiumxtra-protocol-handler/CMakeLists.txt
@@ -15,7 +15,6 @@ target_link_libraries(ktp-adiumxtra-protocol-handler
KF5::Emoticons
Qt5::Xml
KF5::KIOWidgets
- KF5::KDELibs4Support
ktpchat)
diff --git a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp
index 92f11bd..758227b 100644
--- a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp
+++ b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp
@@ -20,18 +20,18 @@
#include "chat-style-installer.h"
#include "emoticon-set-installer.h"
-#include <KDebug>
#include <KZip>
#include <KTar>
#include <KEmoticons>
-#include <KTemporaryFile>
#include <KIO/Job>
-#include <KIO/NetAccess>
#include <KNotification>
-#include <KMimeType>
-#include <KAboutData>
-#include <KComponentData>
-#include <KUrl>
+#include <KLocalizedString>
+
+#include <QTemporaryFile>
+#include <QUrl>
+#include <QDebug>
+#include <QMimeDatabase>
+#include <QMimeType>
// FIXME: Part of a hack to let adiumxtra-protocol-handler use the main ktelepathy.notifyrc because
// the string freeze does not permit adding a new notifyrc only for adiumxtra-protocol-handler.
@@ -43,34 +43,30 @@ static QString ktelepathyComponentName() {
AdiumxtraProtocolHandler::AdiumxtraProtocolHandler()
: QObject()
{
- kDebug();
}
AdiumxtraProtocolHandler::~AdiumxtraProtocolHandler()
{
- kDebug();
}
void AdiumxtraProtocolHandler::install()
{
- kDebug();
-
if (m_url.isEmpty()) {
Q_EMIT finished();
return; // BundleInstaller:: xxxxx
}
- KUrl url(m_url);
- if(url.protocol() == QLatin1String("adiumxtra")) {
- url.setProtocol(QLatin1String("http"));
+ QUrl url = QUrl::fromUserInput(m_url);
+ if(url.scheme() == QLatin1String("adiumxtra")) {
+ url.setScheme(QStringLiteral("http"));
}
- KTemporaryFile *tmpFile = new KTemporaryFile();
+ QTemporaryFile *tmpFile = new QTemporaryFile();
if (tmpFile->open()) {
- KIO::Job* getJob = KIO::file_copy(url.prettyUrl(), KUrl(tmpFile->fileName()), -1,
+ KIO::Job* getJob = KIO::file_copy(url.toDisplayString(), QUrl(tmpFile->fileName()), -1,
KIO::Overwrite | KIO::HideProgressInfo);
- if (!KIO::NetAccess::synchronousRun(getJob, 0)) {
- kDebug() << "Download failed";
+ if (getJob->exec()) {
+ qWarning() << "Download failed";
Q_EMIT finished();
return; // BundleInstaller::BundleCannotOpen;
}
@@ -79,7 +75,9 @@ void AdiumxtraProtocolHandler::install()
KArchive *archive = 0L;
- QString currentBundleMimeType = KMimeType::findByPath(tmpFile->fileName(), 0, false)->name();
+ QMimeDatabase db;
+
+ QString currentBundleMimeType = db.mimeTypeForFile(tmpFile->fileName()).name();
if (currentBundleMimeType == QLatin1String("application/zip")) {
archive = new KZip(tmpFile->fileName());
} else if (currentBundleMimeType == QLatin1String("application/x-compressed-tar") ||
@@ -95,15 +93,14 @@ void AdiumxtraProtocolHandler::install()
QObject::connect(notification, SIGNAL(ignored()), notification, SLOT(close()));
notification->setComponentName(ktelepathyComponentName());
notification->sendEvent();
- kDebug() << "Unsupported file type" << currentBundleMimeType;
- kDebug() << tmpFile->fileName();
+ qWarning() << "Unsupported file type" << currentBundleMimeType;
Q_EMIT finished();
return;// BundleInstaller::BundleNotValid;
}
if (!archive->open(QIODevice::ReadOnly)) {
delete archive;
- kDebug() << "Cannot open theme file";
+ qWarning() << "Cannot open theme file";
Q_EMIT finished();
return;// BundleInstaller::BundleCannotOpen;
}
@@ -111,7 +108,6 @@ void AdiumxtraProtocolHandler::install()
ChatStyleInstaller *chatStyleInstaller = new ChatStyleInstaller(archive, tmpFile);
if (chatStyleInstaller->validate() == BundleInstaller::BundleValid) {
chatStyleInstaller->showRequest();
- kDebug() << "Sent messagestyle request";
QObject::connect(chatStyleInstaller, SIGNAL(finished(BundleInstaller::BundleStatus)),
chatStyleInstaller, SLOT(showResult()));
@@ -129,7 +125,6 @@ void AdiumxtraProtocolHandler::install()
EmoticonSetInstaller *emoticonSetInstaller = new EmoticonSetInstaller(archive, tmpFile);
if(emoticonSetInstaller->validate() == BundleInstaller::BundleValid) {
emoticonSetInstaller->showRequest();
- kDebug() << "Sent emoticonset request";
QObject::connect(emoticonSetInstaller, SIGNAL(finished(BundleInstaller::BundleStatus)),
emoticonSetInstaller, SLOT(showResult()));
@@ -153,7 +148,6 @@ void AdiumxtraProtocolHandler::install()
notification->setActions( QStringList() << i18n("OK") );
notification->setComponentName(ktelepathyComponentName());
notification->sendEvent();
- kDebug() << "Sent error";
Q_EMIT finished();
return;// BundleInstaller::BundleUnknownError;
diff --git a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h
index 6eb3d9e..6ef3acf 100644
--- a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h
+++ b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h
@@ -21,7 +21,7 @@
#include "bundle-installer.h"
-#include <QtCore/QObject>
+#include <QObject>
class AdiumxtraProtocolHandler : public QObject
{
diff --git a/adiumxtra-protocol-handler/bundle-installer.cpp b/adiumxtra-protocol-handler/bundle-installer.cpp
index b402d9e..97a52db 100644
--- a/adiumxtra-protocol-handler/bundle-installer.cpp
+++ b/adiumxtra-protocol-handler/bundle-installer.cpp
@@ -17,9 +17,7 @@
*/
#include "bundle-installer.h"
-#include <KDebug>
BundleInstaller::~BundleInstaller()
{
- kDebug();
}
diff --git a/adiumxtra-protocol-handler/chat-style-installer.cpp b/adiumxtra-protocol-handler/chat-style-installer.cpp
index d6bc756..cc5c22d 100644
--- a/adiumxtra-protocol-handler/chat-style-installer.cpp
+++ b/adiumxtra-protocol-handler/chat-style-installer.cpp
@@ -21,15 +21,13 @@
#include "chat-window-style-manager.h"
#include "chat-style-plist-file-reader.h"
-#include <KDebug>
-#include <KTemporaryFile>
+#include <QTemporaryFile>
+#include <QTimer>
+#include <QDebug>
+
+#include <KLocalizedString>
#include <KArchiveFile>
-#include <KLocale>
#include <KNotification>
-#include <KApplication>
-#include <QTimer>
-#include <KAboutData>
-#include <KComponentData>
// FIXME: Part of a hack to let adiumxtra-protocol-handler use the main ktelepathy.notifyrc because
// the string freeze does not permit adding a new notifyrc only for adiumxtra-protocol-handler.
@@ -38,23 +36,18 @@ static QString ktelepathyComponentName() {
return QStringLiteral("ktelepathy");
}
-ChatStyleInstaller::ChatStyleInstaller(KArchive *archive, KTemporaryFile *tmpFile)
+ChatStyleInstaller::ChatStyleInstaller(KArchive *archive, QTemporaryFile *tmpFile)
{
- kDebug();
-
m_archive = archive;
m_tmpFile = tmpFile;
}
ChatStyleInstaller::~ChatStyleInstaller()
{
- kDebug();
}
BundleInstaller::BundleStatus ChatStyleInstaller::validate()
{
- kDebug();
-
KArchiveEntry *currentEntry = 0L;
KArchiveDirectory* currentDir = 0L;
const KArchiveDirectory* rootDir = m_archive->directory();
@@ -64,18 +57,15 @@ BundleInstaller::BundleStatus ChatStyleInstaller::validate()
for (entriesIt = entries.begin(); entriesIt != entries.end(); ++entriesIt) {
currentEntry = const_cast<KArchiveEntry*>(rootDir->entry(*entriesIt));
- kDebug() << "Current entry name: " << currentEntry->name();
if (currentEntry->isDirectory()) {
currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
if (currentDir) {
if (currentDir->entry(QLatin1String("Contents")) &&
currentDir->entry(QLatin1String("Contents"))->isDirectory()) {
- kDebug() << "Contents found";
validResult += 1;
}
if (currentDir->entry(QLatin1String("Contents/Info.plist")) &&
currentDir->entry(QLatin1String("Contents/Info.plist"))->isFile()) {
- kDebug() << "Contents/Info.plist found";
KArchiveFile const *info = dynamic_cast<KArchiveFile const *>(
currentDir->entry(QLatin1String("Contents/Info.plist"))
);
@@ -91,29 +81,23 @@ BundleInstaller::BundleStatus ChatStyleInstaller::validate()
}
if(validResult >= 2) {
- kDebug() << "Bundle is valid";
return BundleValid;
} else {
- kDebug() << "Bundle is not valid";
+ qWarning() << "Bundle is not valid";
return BundleNotValid;
}
}
QString ChatStyleInstaller::bundleName() const
{
- kDebug();
-
return m_bundleName;
}
BundleInstaller::BundleStatus ChatStyleInstaller::install()
{
- kDebug();
-
BundleInstaller::BundleStatus status = static_cast<BundleInstaller::BundleStatus>(
ChatWindowStyleManager::self()->installStyle(m_archive->fileName())
);
- kDebug()<< "status " << status;
delete m_tmpFile;
m_status = status;
@@ -125,8 +109,6 @@ BundleInstaller::BundleStatus ChatStyleInstaller::install()
void ChatStyleInstaller::showRequest()
{
- kDebug();
-
KNotification *notification = new KNotification(QLatin1String("chatstyleRequest"), NULL, KNotification::Persistent);
notification->setText( i18n("Install Chatstyle %1", this->bundleName()) );
notification->setActions( QStringList() << i18n("Install") << i18n("Cancel") );
@@ -146,15 +128,13 @@ void ChatStyleInstaller::showRequest()
void ChatStyleInstaller::showResult()
{
- kDebug();
-
KNotification *notification;
if(m_status == BundleInstaller::BundleInstallOk) {
- kDebug() << "Installed Chatstyle" << this->bundleName() << "successfully";
+ qDebug() << "Installed Chatstyle" << this->bundleName() << "successfully";
notification = new KNotification(QLatin1String("chatstyleSuccess"));
notification->setText( i18n("Installed Chatstyle %1 successfully.", this->bundleName()) );
} else {
- kDebug() << "Installation of Chatstyle" << this->bundleName() << "failed";
+ qWarning() << "Installation of Chatstyle" << this->bundleName() << "failed";
notification = new KNotification(QLatin1String("chatstyleFailure"));
notification->setText( i18n("Installation of Chatstyle %1 failed.", this->bundleName()) );
}
@@ -166,7 +146,5 @@ void ChatStyleInstaller::showResult()
void ChatStyleInstaller::ignoreRequest()
{
- kDebug();
-
Q_EMIT ignoredRequest();
}
diff --git a/adiumxtra-protocol-handler/chat-style-installer.h b/adiumxtra-protocol-handler/chat-style-installer.h
index 9c746bf..7c92b06 100644
--- a/adiumxtra-protocol-handler/chat-style-installer.h
+++ b/adiumxtra-protocol-handler/chat-style-installer.h
@@ -21,16 +21,14 @@
#include "bundle-installer.h"
-#include <KDebug>
-
-class KTemporaryFile;
+class QTemporaryFile;
class ChatStyleInstaller : public BundleInstaller
{
Q_OBJECT
public:
- ChatStyleInstaller(KArchive *archive, KTemporaryFile *tmpFile);
+ ChatStyleInstaller(KArchive *archive, QTemporaryFile *tmpFile);
virtual ~ChatStyleInstaller();
virtual BundleInstaller::BundleStatus validate();
@@ -44,7 +42,7 @@ public Q_SLOTS:
private:
KArchive *m_archive;
- KTemporaryFile *m_tmpFile;
+ QTemporaryFile *m_tmpFile;
QString m_bundleName;
BundleInstaller::BundleStatus m_status;
};
diff --git a/adiumxtra-protocol-handler/emoticon-set-installer.cpp b/adiumxtra-protocol-handler/emoticon-set-installer.cpp
index 6c97f74..0c57bc6 100644
--- a/adiumxtra-protocol-handler/emoticon-set-installer.cpp
+++ b/adiumxtra-protocol-handler/emoticon-set-installer.cpp
@@ -20,15 +20,13 @@
#include "chat-style-plist-file-reader.h"
-#include <KDebug>
-#include <KTemporaryFile>
+#include <QTemporaryFile>
+
#include <KArchiveFile>
#include <KEmoticons>
#include <KArchiveDirectory>
#include <KNotification>
-#include <KLocale>
-#include <KAboutData>
-#include <KComponentData>
+#include <KLocalizedString>
// FIXME: Part of a hack to let adiumxtra-protocol-handler use the main ktelepathy.notifyrc because
// the string freeze does not permit adding a new notifyrc only for adiumxtra-protocol-handler.
@@ -37,23 +35,18 @@ static QString ktelepathyComponentName() {
return QStringLiteral("ktelepathy");
}
-EmoticonSetInstaller::EmoticonSetInstaller(KArchive *archive, KTemporaryFile *tmpFile)
+EmoticonSetInstaller::EmoticonSetInstaller(KArchive *archive, QTemporaryFile *tmpFile)
{
- kDebug();
-
m_archive = archive;
m_tmpFile = tmpFile;
}
EmoticonSetInstaller::~EmoticonSetInstaller()
{
- kDebug();
}
BundleInstaller::BundleStatus EmoticonSetInstaller::validate()
{
- kDebug();
-
KArchiveEntry *currentEntry = 0L;
KArchiveDirectory* currentDir = 0L;
if(m_archive == 0) exit(1);
@@ -65,12 +58,10 @@ BundleInstaller::BundleStatus EmoticonSetInstaller::validate()
QStringList::ConstIterator entriesIt;
for (entriesIt = entries.begin(); entriesIt != entries.end(); ++entriesIt) {
currentEntry = const_cast<KArchiveEntry*>(rootDir->entry(*entriesIt));
- kDebug() << "Current entry name: " << currentEntry->name();
if (currentEntry->isDirectory()) {
currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
if (currentDir) {
if (currentDir->entry(QString::fromUtf8("Emoticons.plist"))) {
- kDebug() << "Emoticons.plist found";
QString currentItem = currentEntry->name();
if(m_bundleName.isEmpty() && currentItem.endsWith(QLatin1String(".AdiumEmoticonset"))) {
m_bundleName = currentItem.remove(QLatin1String(".AdiumEmoticonset"));
@@ -86,15 +77,11 @@ BundleInstaller::BundleStatus EmoticonSetInstaller::validate()
QString EmoticonSetInstaller::bundleName() const
{
- kDebug();
-
return m_bundleName;
}
BundleInstaller::BundleStatus EmoticonSetInstaller::install()
{
- kDebug();
-
KEmoticons emoticons;
emoticons.installTheme(m_tmpFile->fileName());
@@ -107,8 +94,6 @@ BundleInstaller::BundleStatus EmoticonSetInstaller::install()
void EmoticonSetInstaller::showRequest()
{
- kDebug();
-
KNotification *notification = new KNotification(QLatin1String("emoticonsRequest"), NULL, KNotification::Persistent);
notification->setText( i18n("Install Emoticonset %1", this->bundleName()) );
notification->setActions( QStringList() << i18n("Install") << i18n("Cancel") );
@@ -128,8 +113,6 @@ void EmoticonSetInstaller::showRequest()
void EmoticonSetInstaller::showResult()
{
- kDebug();
-
KNotification *notification = new KNotification(QLatin1String("emoticonsSuccess"));
notification->setText( i18n("Installed Emoticonset %1 successfully.", this->bundleName()) );
notification->setComponentName(ktelepathyComponentName());
@@ -140,8 +123,6 @@ void EmoticonSetInstaller::showResult()
void EmoticonSetInstaller::ignoreRequest()
{
- kDebug();
-
Q_EMIT ignoredRequest();
}
diff --git a/adiumxtra-protocol-handler/emoticon-set-installer.h b/adiumxtra-protocol-handler/emoticon-set-installer.h
index 50bdd28..bf2dd4f 100644
--- a/adiumxtra-protocol-handler/emoticon-set-installer.h
+++ b/adiumxtra-protocol-handler/emoticon-set-installer.h
@@ -21,14 +21,14 @@
#include "bundle-installer.h"
-class KTemporaryFile;
+class QTemporaryFile;
class EmoticonSetInstaller : public BundleInstaller
{
Q_OBJECT
public:
- EmoticonSetInstaller(KArchive *archive, KTemporaryFile *tmpFile);
+ EmoticonSetInstaller(KArchive *archive, QTemporaryFile *tmpFile);
virtual ~EmoticonSetInstaller();
virtual BundleStatus validate();
@@ -42,7 +42,7 @@ public Q_SLOTS:
private:
KArchive *m_archive;
- KTemporaryFile *m_tmpFile;
+ QTemporaryFile *m_tmpFile;
QString m_bundleName;
};
diff --git a/adiumxtra-protocol-handler/main.cpp b/adiumxtra-protocol-handler/main.cpp
index e2361a7..8ad46c4 100644
--- a/adiumxtra-protocol-handler/main.cpp
+++ b/adiumxtra-protocol-handler/main.cpp
@@ -19,35 +19,39 @@
#include "adiumxtra-protocol-handler.h"
#include "../ktptextui_version.h"
-#include <KApplication>
-#include <k4aboutdata.h>
-#include <KCmdLineArgs>
+#include <KAboutData>
+#include <KLocalizedString>
+
+#include <QApplication>
+#include <QCommandLineParser>
#include <QTimer>
int main(int argc, char *argv[])
{
- K4AboutData aboutData("ktp-adiumxtra-protocol-handler",
- 0,
- ki18n("AdiumXtra Protocol Handler"),
- KTP_TEXT_UI_VERSION_STRING);
- aboutData.addAuthor(ki18n("Dominik Schmidt"), ki18n("Developer"), "kde at dominik-schmidt.de");
- aboutData.addAuthor(ki18n("Daniele E. Domenichelli"), ki18n("Developer"), "daniele.domenichelli at gmail.com");
+ QApplication app(argc, argv);
+
+ KAboutData aboutData("ktp-adiumxtra-protocol-handler",
+ i18n("AdiumXtra Protocol Handler"),
+ QStringLiteral(KTP_TEXT_UI_VERSION_STRING));
+ aboutData.addAuthor(i18n("Dominik Schmidt"), i18n("Developer"), "kde at dominik-schmidt.de");
+ aboutData.addAuthor(i18n("Daniele E. Domenichelli"), i18n("Developer"), "daniele.domenichelli at gmail.com");
aboutData.setProductName("telepathy/text-ui"); //set the correct name for bug reporting
- aboutData.setLicense(K4AboutData::License_GPL_V2);
- KCmdLineArgs::init(argc, argv, &aboutData);
- KCmdLineOptions options;
- options.add("!+adium-bundle", ki18n("Adium package to install"));
- KCmdLineArgs::addCmdLineOptions(options);
+ aboutData.setLicense(KAboutLicense::GPL_V2);
+
+ KAboutData::setApplicationData(aboutData);
+
+ QCommandLineParser parser;
+ QCommandLineOption adiumBundleOption(QStringLiteral("adium-bundle"), i18n("Adium package to install"));
+ parser.addOption(adiumBundleOption);
+ parser.process(app);
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
- KApplication app;
- if (args->count() == 0) {
+ if (parser.positionalArguments().count() == 0) {
return -1;
}
AdiumxtraProtocolHandler handler;
- handler.setUrl(KCmdLineArgs::parsedArgs()->arg(0));
+ handler.setUrl(parser.value(adiumBundleOption));
app.connect(&handler, SIGNAL(finished()), SLOT(quit()));
QTimer::singleShot(0, &handler, SLOT(install()));
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list