void EmoticonSetInstaller::showResult() { kDebug(); KNotification *notification = new KNotification(QLatin1String("emoticonsSuccess"), NULL, KNotification::Persistent); notification->setText( i18n("Installed Emoticonset %1 successfully.", this->bundleName()) ); notification->setActions( QStringList() << i18n("OK") ); QObject::connect(notification, SIGNAL(action1Activated()), notification, SLOT(close())); QObject::connect(notification, SIGNAL(ignored()), notification, SLOT(close())); notification->sendEvent(); Q_EMIT showedResult(); }
void AdiumxtraProtocolHandler::install() { if (m_url.isEmpty()) { Q_EMIT finished(); return; // BundleInstaller:: xxxxx } QUrl url = QUrl::fromUserInput(m_url); if(url.scheme() == QLatin1String("adiumxtra")) { url.setScheme(QStringLiteral("http")); } QTemporaryFile *tmpFile = new QTemporaryFile(); if (tmpFile->open()) { KIO::Job* getJob = KIO::file_copy(url, QUrl::fromLocalFile(tmpFile->fileName()), -1, KIO::Overwrite | KIO::HideProgressInfo); if (getJob->exec()) { qWarning() << "Download failed"; Q_EMIT finished(); return; // BundleInstaller::BundleCannotOpen; } getJob->deleteLater(); } KArchive *archive = 0L; 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") || currentBundleMimeType == QLatin1String("application/x-bzip-compressed-tar") || currentBundleMimeType == QLatin1String("application/x-gzip") || currentBundleMimeType == QLatin1String("application/x-bzip")) { archive = new KTar(tmpFile->fileName()); } else { KNotification *notification = new KNotification(QLatin1String("packagenotrecognized"), NULL, KNotification::Persistent); notification->setText( i18n("Package type not recognized or not supported") ); notification->setActions( QStringList() << i18n("OK") ); QObject::connect(notification, SIGNAL(action1Activated()), notification, SLOT(close())); QObject::connect(notification, SIGNAL(ignored()), notification, SLOT(close())); notification->setComponentName(ktelepathyComponentName()); notification->sendEvent(); qWarning() << "Unsupported file type" << currentBundleMimeType; Q_EMIT finished(); return;// BundleInstaller::BundleNotValid; } if (!archive->open(QIODevice::ReadOnly)) { delete archive; qWarning() << "Cannot open theme file"; Q_EMIT finished(); return;// BundleInstaller::BundleCannotOpen; } ChatStyleInstaller *chatStyleInstaller = new ChatStyleInstaller(archive, tmpFile); if (chatStyleInstaller->validate() == BundleInstaller::BundleValid) { chatStyleInstaller->showRequest(); QObject::connect(chatStyleInstaller, SIGNAL(finished(BundleInstaller::BundleStatus)), chatStyleInstaller, SLOT(showResult())); QObject::connect(chatStyleInstaller, SIGNAL(showedResult()), this, SIGNAL(finished())); QObject::connect(chatStyleInstaller, SIGNAL(showedResult()), chatStyleInstaller, SLOT(deleteLater())); QObject::connect(chatStyleInstaller, SIGNAL(ignoredRequest()), this, SIGNAL(finished())); QObject::connect(chatStyleInstaller, SIGNAL(ignoredRequest()), chatStyleInstaller, SLOT(deleteLater())); return;// BundleInstaller::BundleValid; } delete chatStyleInstaller; EmoticonSetInstaller *emoticonSetInstaller = new EmoticonSetInstaller(archive, tmpFile); if(emoticonSetInstaller->validate() == BundleInstaller::BundleValid) { emoticonSetInstaller->showRequest(); QObject::connect(emoticonSetInstaller, SIGNAL(finished(BundleInstaller::BundleStatus)), emoticonSetInstaller, SLOT(showResult())); QObject::connect(emoticonSetInstaller, SIGNAL(showedResult()), this, SIGNAL(finished())); QObject::connect(emoticonSetInstaller, SIGNAL(showedResult()), emoticonSetInstaller, SLOT(deleteLater())); QObject::connect(emoticonSetInstaller, SIGNAL(ignoredRequest()), this, SIGNAL(finished())); QObject::connect(emoticonSetInstaller, SIGNAL(ignoredRequest()), emoticonSetInstaller, SLOT(deleteLater())); return;// BundleInstaller::BundleValid; } delete emoticonSetInstaller; KNotification *notification = new KNotification(QLatin1String("packagenotrecognized"), NULL, KNotification::Persistent); notification->setText( i18n("Package type not recognized or not supported") ); QObject::connect(notification, SIGNAL(action1Activated()), notification, SLOT(close())); QObject::connect(notification, SIGNAL(ignored()), notification, SLOT(close())); notification->setActions( QStringList() << i18n("OK") ); notification->setComponentName(ktelepathyComponentName()); notification->sendEvent(); Q_EMIT finished(); return;// BundleInstaller::BundleUnknownError; }