diff -ruN kpackagekit/AddRm/CMakeLists.txt kpackagekit-0.4.2/AddRm/CMakeLists.txt --- kpackagekit/AddRm/CMakeLists.txt 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/AddRm/CMakeLists.txt 2009-08-12 20:04:37.000000000 +0200 @@ -10,7 +10,10 @@ ) kde4_add_plugin(kcm_kpk_addrm ${kpk_addrm_SRCS}) -target_link_libraries(kcm_kpk_addrm ${KDE4_KDEUI_LIBS} ${QPACKAGEKIT_LIBRARIES} -kpackagekitlib) +target_link_libraries(kcm_kpk_addrm + ${KDE4_KDEUI_LIBS} + ${QPACKAGEKIT_LIBRARIES} + kpackagekitlib +) install(TARGETS kcm_kpk_addrm DESTINATION ${PLUGIN_INSTALL_DIR} ) diff -ruN kpackagekit/AddRm/KcmKpkAddRm.cpp kpackagekit-0.4.2/AddRm/KcmKpkAddRm.cpp --- kpackagekit/AddRm/KcmKpkAddRm.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/AddRm/KcmKpkAddRm.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -25,20 +25,26 @@ #include -K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin(); ) +K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin();) K_EXPORT_PLUGIN(KPackageKitFactory("kcm_kpk_addrm")) KcmKpkAddRm::KcmKpkAddRm(QWidget *parent, const QVariantList &args) : KCModule(KPackageKitFactory::componentData(), parent, args) { - KGlobal::locale()->insertCatalog("kpackagekit"); - KAboutData *about = new KAboutData("kcm_kpk_addrm", "kpackagekit", ki18n("Add and Remove Software"), KPK_VERSION); - setAboutData(about); + KAboutData *aboutData; + aboutData = new KAboutData("kpackagekit", + "kpackagekit", + ki18n("Add and remove software"), + KPK_VERSION, + ki18n("KDE interface for managing software"), + KAboutData::License_GPL, + ki18n("(C) 2008-2009 Daniel Nicoletti")); + setAboutData(aboutData); setButtons(Apply); m_grid = new QGridLayout(this); view = new KpkAddRm(this); - connect(this, SIGNAL(s_load()), view, SLOT(load()) ); - connect(this, SIGNAL(s_save()), view, SLOT(save()) ); - connect(view, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)) ); + connect(this, SIGNAL(s_load()), view, SLOT(load())); + connect(this, SIGNAL(s_save()), view, SLOT(save())); + connect(view, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); m_grid->addWidget(view); } diff -ruN kpackagekit/AddRm/KpkAddRm.cpp kpackagekit-0.4.2/AddRm/KpkAddRm.cpp --- kpackagekit/AddRm/KpkAddRm.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/AddRm/KpkAddRm.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Daniel Nicoletti * + * Copyright (C) 2008-2009 by Daniel Nicoletti * * dantti85-pk@yahoo.com.br * * * * This program is free software; you can redistribute it and/or modify * @@ -38,8 +38,12 @@ KCONFIGGROUP_DECLARE_ENUM_QOBJECT(Client, Filter) KpkAddRm::KpkAddRm(QWidget *parent) - : QWidget(parent), m_currentAction(0), m_mTransRuning(false), m_findIcon("edit-find"), - m_cancelIcon("dialog-cancel"), m_filterIcon("view-filter") + : QWidget(parent) + , m_currentAction(0) + , m_mTransRuning(false) + , m_findIcon("edit-find") + , m_cancelIcon("dialog-cancel") + , m_filterIcon("view-filter") { setupUi( this ); @@ -59,10 +63,10 @@ // check to see if the backend support these actions m_actions = m_client->getActions(); - if ((m_actions & Client::ActionInstallPackages) || (m_actions & Client::ActionRemovePackages)) { - connect(m_pkg_model_main, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)), - this, SLOT(checkChanged()) ); - } + // Connect this signal anyway so users that have backend that + // do not support install or remove can be informed properly + connect(m_pkg_model_main, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)), + this, SLOT(checkChanged())); m_findMenu = new QMenu(this); // find is just a generic name in case we don't have any search method @@ -242,7 +246,9 @@ void KpkAddRm::errorCode(PackageKit::Client::ErrorType error, const QString &details) { - KMessageBox::detailedSorry(this, KpkStrings::errorMessage(error), details, KpkStrings::error(error), KMessageBox::Notify); + if (error != Client::ErrorTransactionCancelled) { + KMessageBox::detailedSorry(this, KpkStrings::errorMessage(error), details, KpkStrings::error(error), KMessageBox::Notify); + } } KpkAddRm::~KpkAddRm() @@ -398,7 +404,7 @@ void KpkAddRm::save() { - KpkReviewChanges *frm = new KpkReviewChanges(m_pkg_model_main->selectedPackages(), this); + QPointer frm = new KpkReviewChanges(m_pkg_model_main->selectedPackages(), this); frm->setTitle(i18n("Review Changes")); if (frm->exec() == QDialog::Accepted) { m_pkg_model_main->uncheckAll(); diff -ruN kpackagekit/CMakeLists.txt kpackagekit-0.4.2/CMakeLists.txt --- kpackagekit/CMakeLists.txt 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/CMakeLists.txt 2009-08-12 20:19:17.000000000 +0200 @@ -21,3 +21,6 @@ add_subdirectory( SmartIcon ) add_subdirectory( KPackageKitD ) add_subdirectory( Desktop ) +find_package(Msgfmt REQUIRED) +find_package(Gettext REQUIRED) +add_subdirectory( po ) diff -ruN kpackagekit/debugfiles.list kpackagekit-0.4.2/debugfiles.list --- kpackagekit/debugfiles.list 1970-01-01 01:00:00.000000000 +0100 +++ kpackagekit-0.4.2/debugfiles.list 2009-10-25 02:37:23.000000000 +0100 @@ -0,0 +1,8 @@ +/usr/lib/debug/usr/bin/kpackagekit.debug +/usr/lib/debug/usr/lib/kde4/kcm_kpk_settings.so.debug +/usr/lib/debug/usr/lib/kde4/kcm_kpk_update.so.debug +/usr/lib/debug/usr/lib/kde4/kded_kpackagekitd.so.debug +/usr/lib/debug/usr/lib/kde4/libexec/kpackagekitsmarticon.debug +/usr/lib/debug/usr/lib/kde4/kcm_kpk_addrm.so.debug +/usr/lib/debug/usr/lib/libkpackagekitlib.so.debug +/usr/src/debug/kpackagekit-0.4.2 A(z) kpackagekit/debugsources.list és a(z) kpackagekit-0.4.2/debugsources.list fájlok különböznek diff -ruN kpackagekit/KPackageKit/CMakeLists.txt kpackagekit-0.4.2/KPackageKit/CMakeLists.txt --- kpackagekit/KPackageKit/CMakeLists.txt 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/KPackageKit/CMakeLists.txt 2009-08-12 20:04:58.000000000 +0200 @@ -9,15 +9,24 @@ KpkInstallProvideFile.cpp KpkRemovePackageByFile.cpp KpkBackendDetails.cpp + KpkMainUi.cpp ) kde4_add_ui_files(kpackagekit_SRCS KpkBackendDetails.ui ) -kde4_add_executable(kpackagekit ${kpackagekit_SRCS}) +kde4_add_executable(kpackagekit + ${kpackagekit_SRCS} +) -target_link_libraries(kpackagekit ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KUTILS_LIBS} ${QPACKAGEKIT_LIBRARIES} kpackagekitlib) +target_link_libraries(kpackagekit + ${KDE4_KDEUI_LIBS} + ${KDE4_KIO_LIBS} + ${KDE4_KUTILS_LIBS} + ${QPACKAGEKIT_LIBRARIES} + kpackagekitlib +) install(TARGETS kpackagekit ${INSTALL_TARGETS_DEFAULT_ARGS}) diff -ruN kpackagekit/KPackageKit/KPackageKit.cpp kpackagekit-0.4.2/KPackageKit/KPackageKit.cpp --- kpackagekit/KPackageKit/KPackageKit.cpp 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/KPackageKit/KPackageKit.cpp 2009-08-12 20:04:58.000000000 +0200 @@ -42,12 +42,11 @@ KPackageKit::KPackageKit() : KUniqueApplication(), m_pkUi(0), - m_addrmPWI(0), - m_updatePWI(0), - m_settingsPWI(0), m_running(0) { Client::instance()->setLocale(KGlobal::locale()->language() + '.' + KGlobal::locale()->encoding()); + + setQuitOnLastWindowClosed(false); } KPackageKit::~KPackageKit() @@ -65,10 +64,11 @@ void KPackageKit::kcmFinished() { // kcm is finished we set to 0 to be able to quit + m_pkUi->deleteLater(); m_pkUi = 0; - m_addrmPWI = 0; - m_updatePWI = 0; - m_settingsPWI = 0; +// m_addrmPWI = 0; +// m_updatePWI = 0; +// m_settingsPWI = 0; appClose(); } @@ -158,7 +158,6 @@ showUi(); } - args->clear(); return 0; } @@ -166,73 +165,35 @@ void KPackageKit::showUi() { if (!m_pkUi) { - kDebug() << "GO UI!"; - m_pkUi = new KCMultiDialog(); - m_pkUi->setCaption(QString()); - m_pkUi->setWindowIcon(KIcon("applications-other")); - connect(m_pkUi, SIGNAL(finished()), this, SLOT (appClose())); - m_addrmPWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_addrm.desktop")); - m_updatePWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_update.desktop")); - m_settingsPWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_settings.desktop")); - m_pkUi->show(); - m_pkUi->activateWindow(); - m_pkUi->raise(); - } else { - kDebug() << "RAISE UI!"; - // check to see if all are added - if (!m_addrmPWI) { - m_addrmPWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_addrm.desktop")); - } - if (!m_updatePWI) { - m_updatePWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_update.desktop")); - } - if (!m_settingsPWI) { - m_settingsPWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_settings.desktop")); - } - m_pkUi->setCurrentPage(m_addrmPWI); - m_pkUi->activateWindow(); - m_pkUi->raise(); + m_pkUi = new KpkMainUi(); + connect(m_pkUi, SIGNAL(finished()), this, SLOT (kcmFinished())); } + // Show all + m_pkUi->showAll(); + m_pkUi->show(); + m_pkUi->activateWindow(); } void KPackageKit::showUpdates() { if (!m_pkUi) { - kDebug() << "GO UI!"; - m_pkUi = new KCMultiDialog(); - m_pkUi->setCaption(QString()); - m_pkUi->setWindowIcon(KIcon("applications-other")); - connect(m_pkUi, SIGNAL(finished()), this, SLOT(appClose())); - m_updatePWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_update.desktop")); - m_pkUi->show(); - m_pkUi->raise(); - } else { - if (!m_updatePWI) { - m_updatePWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_update.desktop")); - } - m_pkUi->setCurrentPage(m_updatePWI); - m_pkUi->activateWindow(); + m_pkUi = new KpkMainUi(); + connect(m_pkUi, SIGNAL(finished()), this, SLOT(kcmFinished())); } + m_pkUi->showUpdates(); + m_pkUi->show(); + m_pkUi->activateWindow(); } void KPackageKit::showSettings() { if (!m_pkUi) { - kDebug() << "GO UI!"; - m_pkUi = new KCMultiDialog(); - m_pkUi->setCaption(QString()); - m_pkUi->setWindowIcon(KIcon("applications-other")); - connect(m_pkUi, SIGNAL(finished()), this, SLOT(appClose())); - m_settingsPWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_settings.desktop")); - m_pkUi->show(); - m_pkUi->raise(); - } else { - if (!m_settingsPWI) { - m_settingsPWI = m_pkUi->addModule(KCModuleInfo::KCModuleInfo("kpk_settings.desktop")); - } - m_pkUi->setCurrentPage(m_settingsPWI); - m_pkUi->activateWindow(); + m_pkUi = new KpkMainUi(); + connect(m_pkUi, SIGNAL(finished()), this, SLOT(kcmFinished())); } + m_pkUi->showSettings(); + m_pkUi->show(); + m_pkUi->activateWindow(); } } diff -ruN kpackagekit/KPackageKit/KPackageKit.h kpackagekit-0.4.2/KPackageKit/KPackageKit.h --- kpackagekit/KPackageKit/KPackageKit.h 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/KPackageKit/KPackageKit.h 2009-08-12 20:04:58.000000000 +0200 @@ -22,7 +22,7 @@ #define KPACKAGEKIT_H #include -#include +#include "KpkMainUi.h" namespace kpackagekit { @@ -46,10 +46,10 @@ void decreaseAndKillRunning(); private: - KCMultiDialog *m_pkUi; - KPageWidgetItem *m_addrmPWI; - KPageWidgetItem *m_updatePWI; - KPageWidgetItem *m_settingsPWI; + KpkMainUi *m_pkUi; +// KPageWidgetItem *m_addrmPWI; +// KPageWidgetItem *m_updatePWI; +// KPageWidgetItem *m_settingsPWI; int m_running; }; diff -ruN kpackagekit/KPackageKit/KpkBackendDetails.cpp kpackagekit-0.4.2/KPackageKit/KpkBackendDetails.cpp --- kpackagekit/KPackageKit/KpkBackendDetails.cpp 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/KPackageKit/KpkBackendDetails.cpp 2009-08-12 20:04:58.000000000 +0200 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Daniel Nicoletti * + * Copyright (C) 2009 by Daniel Nicoletti * * dantti85-pk@yahoo.com.br * * * * This program is free software; you can redistribute it and/or modify * diff -ruN kpackagekit/KPackageKit/KpkBackendDetails.ui kpackagekit-0.4.2/KPackageKit/KpkBackendDetails.ui --- kpackagekit/KPackageKit/KpkBackendDetails.ui 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/KPackageKit/KpkBackendDetails.ui 2009-08-12 20:04:58.000000000 +0200 @@ -6,13 +6,10 @@ 0 0 - 399 + 407 454 - - Form - 0 @@ -26,7 +23,7 @@ - General + About Backend @@ -39,7 +36,7 @@ - name + backend name here @@ -53,7 +50,7 @@ - author + backend author name here @@ -484,7 +481,7 @@ false - Visible + Package is visible true @@ -532,7 +529,7 @@ false - Free + Free software true diff -ruN kpackagekit/KPackageKit/KpkInstallFiles.cpp kpackagekit-0.4.2/KPackageKit/KpkInstallFiles.cpp --- kpackagekit/KPackageKit/KpkInstallFiles.cpp 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/KPackageKit/KpkInstallFiles.cpp 2009-08-12 20:04:58.000000000 +0200 @@ -22,6 +22,7 @@ #include #include +#include #include @@ -101,6 +102,8 @@ i18n("Install?"), installBt); if (ret == KMessageBox::Yes) { + // Just in case it want to download some dependency + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); if (Transaction *t = Client::instance()->installFiles(files, true)) { KpkTransaction *trans = new KpkTransaction(t); connect(trans, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)), @@ -147,6 +150,7 @@ break; case KpkTransaction::ReQueue : kDebug() << "ReQueue"; + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); transaction->setTransaction(Client::instance()->installFiles(m_transactionFiles[transaction], false)); // return to avoid the decreaseRunning() return; diff -ruN kpackagekit/KPackageKit/KpkMainUi.cpp kpackagekit-0.4.2/KPackageKit/KpkMainUi.cpp --- kpackagekit/KPackageKit/KpkMainUi.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kpackagekit-0.4.2/KPackageKit/KpkMainUi.cpp 2009-08-12 20:04:58.000000000 +0200 @@ -0,0 +1,88 @@ +/*************************************************************************** + * Copyright (C) 2009 by Daniel Nicoletti * + * dantti85-pk@yahoo.com.br * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; see the file COPYING. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "KpkMainUi.h" + +#include +#include +#include +#include + +using namespace PackageKit; + +KpkMainUi::KpkMainUi(QWidget *parent) + : KCMultiDialog(parent), + m_addrmPWI(0), + m_updatePWI(0), + m_settingsPWI(0) +{ + setCaption(QString()); + setWindowIcon(KIcon("applications-other")); + + KConfig config("KPackageKit"); + KConfigGroup kpackagekitMain(&config, "KpkMainUi"); + restoreDialogSize(kpackagekitMain); + + // Set Apply and Cancel buttons +// setButtons(KDialog::Apply | KDialog::Help | KDialog::Default /*| KDialog::Reset*/); +// enableButton(KDialog::Apply, false); +// enableButton(KDialog::Help, false); +// enableButton(KDialog::Default, false); + // Find out how to call load() on the kcm +// enableButton(KDialog::Reset, false); +} + +KpkMainUi::~KpkMainUi() +{ + // save size + KConfig config("KPackageKit"); + KConfigGroup kpackagekitMain(&config, "KpkMainUi"); + saveDialogSize(kpackagekitMain); + kDebug(); +} + +void KpkMainUi::showAll() +{ + // check to see if all are added + showSettings(); + showUpdates(); + if (!m_addrmPWI) { + m_addrmPWI = addModule(KCModuleInfo::KCModuleInfo("kpk_addrm.desktop")); + } + setCurrentPage(m_addrmPWI); +} + +void KpkMainUi::showUpdates() +{ + if (!m_updatePWI) { + m_updatePWI = addModule(KCModuleInfo::KCModuleInfo("kpk_update.desktop")); + } + setCurrentPage(m_updatePWI); +} + +void KpkMainUi::showSettings() +{ + if (!m_settingsPWI) { + m_settingsPWI = addModule(KCModuleInfo::KCModuleInfo("kpk_settings.desktop")); + } + setCurrentPage(m_settingsPWI); +} + +#include "KpkMainUi.moc" diff -ruN kpackagekit/KPackageKit/KpkMainUi.h kpackagekit-0.4.2/KPackageKit/KpkMainUi.h --- kpackagekit/KPackageKit/KpkMainUi.h 1970-01-01 01:00:00.000000000 +0100 +++ kpackagekit-0.4.2/KPackageKit/KpkMainUi.h 2009-08-12 20:04:58.000000000 +0200 @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (C) 2009 by Daniel Nicoletti * + * dantti85-pk@yahoo.com.br * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; see the file COPYING. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef KPK_MAIN_UI_H +#define KPK_MAIN_UI_H + +#include + +#include + +using namespace PackageKit; + +class KpkMainUi : public KCMultiDialog +{ +Q_OBJECT + +public: + KpkMainUi(QWidget *parent = 0); + ~KpkMainUi(); + + void showAll(); + void showUpdates(); + void showSettings(); + +private: + KPageWidgetItem *m_addrmPWI; + KPageWidgetItem *m_updatePWI; + KPageWidgetItem *m_settingsPWI; +}; + +#endif diff -ruN kpackagekit/KPackageKitD/kpackagekitd.cpp kpackagekit-0.4.2/KPackageKitD/kpackagekitd.cpp --- kpackagekit/KPackageKitD/kpackagekitd.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/KPackageKitD/kpackagekitd.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,7 @@ #define FIVE_MIN 360000 -K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin(); ) +K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin();) K_EXPORT_PLUGIN(KPackageKitFactory("kpackagekitd")) KPackageKitD::KPackageKitD(QObject *parent, const QList &) @@ -155,11 +156,24 @@ return; } + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); m_refreshCacheT = m_client->refreshCache(true); if (m_refreshCacheT == 0) { // try again in 5 minutes m_qtimer->start(FIVE_MIN); } else { + // If something goes wrong at least kpackagekitSmartIcon + // will show the error + QDBusMessage message; + message = QDBusMessage::createMethodCall("org.kde.KPackageKitSmartIcon", + "/", + "org.kde.KPackageKitSmartIcon", + QLatin1String("WatchTransaction")); + message << qVariantFromValue(m_refreshCacheT->tid()); + QDBusMessage reply = QDBusConnection::sessionBus().call(message); + if (reply.type() != QDBusMessage::ReplyMessage) { + kWarning() << "Message did not receive a reply"; + } connect(m_refreshCacheT, SIGNAL(finished(PackageKit::Transaction::ExitStatus, uint)), this, SLOT(finished(PackageKit::Transaction::ExitStatus, uint))); } diff -ruN kpackagekit/libkpackagekit/CMakeLists.txt kpackagekit-0.4.2/libkpackagekit/CMakeLists.txt --- kpackagekit/libkpackagekit/CMakeLists.txt 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/CMakeLists.txt 2009-08-12 20:04:37.000000000 +0200 @@ -23,6 +23,6 @@ ) kde4_add_library(kpackagekitlib SHARED ${libkpk_SRCS}) -target_link_libraries(kpackagekitlib ${KDE4_KDEUI_LIBS} ${QPACKAGEKIT_LIBRARIES}) +target_link_libraries(kpackagekitlib ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${QPACKAGEKIT_LIBRARIES}) install(TARGETS kpackagekitlib ${INSTALL_TARGETS_DEFAULT_ARGS}) diff -ruN kpackagekit/libkpackagekit/KpkIcons.cpp kpackagekit-0.4.2/libkpackagekit/KpkIcons.cpp --- kpackagekit/libkpackagekit/KpkIcons.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkIcons.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -336,7 +336,7 @@ { switch (type) { case Client::RestartSystem : - return KpkIcons::getIcon("system-restart"); + return KpkIcons::getIcon("system-reboot"); case Client::RestartSession : return KpkIcons::getIcon("system-log-out"); case Client::RestartApplication : diff -ruN kpackagekit/libkpackagekit/KpkPackageModel.cpp kpackagekit-0.4.2/libkpackagekit/KpkPackageModel.cpp --- kpackagekit/libkpackagekit/KpkPackageModel.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkPackageModel.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include using namespace PackageKit; @@ -86,32 +87,44 @@ if (column == 0) { if (order == Qt::DescendingOrder) { qSort(m_packages.begin(), m_packages.end(), packageNameSortGreaterThan); - foreach(const Package::State &group, m_groups.keys()) { - qSort(m_groups[group].begin(), m_groups[group].end(), packageNameSortGreaterThan); + + QMap >::const_iterator i = m_groups.constBegin(); + while (i != m_groups.constEnd()) { + qSort(m_groups[i.key()].begin(), m_groups[i.key()].end(), packageNameSortGreaterThan); + ++i; } } else { qSort(m_packages.begin(), m_packages.end(), packageNameSortLessThan); - foreach(const Package::State &group, m_groups.keys()) { - qSort(m_groups[group].begin(), m_groups[group].end(), packageNameSortLessThan); + + QMap >::const_iterator i = m_groups.constBegin(); + while (i != m_groups.constEnd()) { + qSort(m_groups[i.key()].begin(), m_groups[i.key()].end(), packageNameSortLessThan); + ++i; } } } else if (column == 1) { if (order == Qt::DescendingOrder){ descendingSelectionSorter sort(m_checkedPackages); qSort(m_packages.begin(), m_packages.end(), sort); - foreach(const Package::State &group, m_groups.keys()) { - qSort(m_groups[group].begin(), m_groups[group].end(), sort); + + QMap >::const_iterator i = m_groups.constBegin(); + while (i != m_groups.constEnd()) { + qSort(m_groups[i.key()].begin(), m_groups[i.key()].end(), sort); + ++i; } } else { ascendingSelectionSorter sort(m_checkedPackages); qSort(m_packages.begin(), m_packages.end(), sort); - foreach(const Package::State &group, m_groups.keys()) { - qSort(m_groups[group].begin(), m_groups[group].end(), sort); + + QMap >::const_iterator i = m_groups.constBegin(); + while (i != m_groups.constEnd()) { + qSort(m_groups[i.key()].begin(), m_groups[i.key()].end(), sort); + ++i; } } } if (m_grouped) { - for (int i = 0;i >::const_iterator i = m_groups.constBegin(); + while (i != m_groups.constEnd()) { + QModelIndex groupIndex = index(m_groups.keys().indexOf(i.key()), 0, QModelIndex()); emit dataChanged(index(0, 1, groupIndex), - index(m_groups[group].size(), + index(m_groups[i.key()].size(), 1, groupIndex)); + ++i; } } } @@ -533,12 +548,14 @@ emit dataChanged(createIndex(0, 1), createIndex(m_groups.size(), 1)); if (m_grouped) { - foreach(const Package::State &group, m_groups.keys()) { - QModelIndex groupIndex = index(m_groups.keys().indexOf(group), 0, QModelIndex()); + QMap >::const_iterator i = m_groups.constBegin(); + while (i != m_groups.constEnd()) { + QModelIndex groupIndex = index(m_groups.keys().indexOf(i.key()), 0, QModelIndex()); emit dataChanged(index(0, 1, groupIndex), - index(m_groups[group].size(), + index(m_groups[i.key()].size(), 1, groupIndex)); + ++i; } } } diff -ruN kpackagekit/libkpackagekit/KpkProgressBar.cpp kpackagekit-0.4.2/libkpackagekit/KpkProgressBar.cpp --- kpackagekit/libkpackagekit/KpkProgressBar.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkProgressBar.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -35,7 +35,7 @@ QString KpkProgressBar::text() const { if (m_remaining) { - return i18n("%1 remaining", KGlobal::locale()->formatDuration(m_remaining * 1000)); + return i18n("%1 remaining", KGlobal::locale()->prettyFormatDuration(m_remaining * 1000)); } else { return QProgressBar::text(); } diff -ruN kpackagekit/libkpackagekit/KpkRequirements.cpp kpackagekit-0.4.2/libkpackagekit/KpkRequirements.cpp --- kpackagekit/libkpackagekit/KpkRequirements.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkRequirements.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -19,14 +19,21 @@ ***************************************************************************/ #include "KpkRequirements.h" +#include "ui_KpkRequirements.h" + +class KpkRequirementsPrivate +{ +public: + Ui::KpkRequirements ui; +}; KpkRequirements::KpkRequirements(QString msg, KpkSimplePackageModel *model, QWidget *parent) - : KDialog(parent) + : KDialog(parent), d(new KpkRequirementsPrivate) { - setupUi(mainWidget()); + d->ui.setupUi(mainWidget()); - label->setText(msg); - packageView->setModel(model); + d->ui.label->setText(msg); + d->ui.packageView->setModel(model); setCaption(i18n("Confirm")); setButtons(KDialog::Ok | KDialog::Cancel); setModal(true); diff -ruN kpackagekit/libkpackagekit/KpkRequirements.h kpackagekit-0.4.2/libkpackagekit/KpkRequirements.h --- kpackagekit/libkpackagekit/KpkRequirements.h 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkRequirements.h 2009-08-12 20:04:37.000000000 +0200 @@ -24,16 +24,20 @@ #include #include "KpkSimplePackageModel.h" -#include "ui_KpkRequirements.h" using namespace PackageKit; -class KpkRequirements : public KDialog, Ui::KpkRequirements +class KpkRequirementsPrivate; + +class KDE_EXPORT KpkRequirements : public KDialog { Q_OBJECT public: KpkRequirements(QString msg, KpkSimplePackageModel *model, QWidget *parent = 0); ~KpkRequirements(); + +private: + KpkRequirementsPrivate *d; }; #endif diff -ruN kpackagekit/libkpackagekit/KpkReviewChanges.cpp kpackagekit-0.4.2/libkpackagekit/KpkReviewChanges.cpp --- kpackagekit/libkpackagekit/KpkReviewChanges.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkReviewChanges.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -21,9 +21,11 @@ #include "KpkReviewChanges.h" #include +#include + #include -#include +#include "KpkStrings.h" #include "KpkRequirements.h" #include "ui_KpkReviewChanges.h" @@ -140,8 +142,9 @@ connect(m_transactionReq, SIGNAL(errorCode(PackageKit::Client::ErrorType, const QString &)), this, SLOT(errorCode(PackageKit::Client::ErrorType, const QString &))); // Create a Transaction dialog to don't upset the user - KpkTransaction* reqFinder = new KpkTransaction(m_transactionReq, KpkTransaction::CloseOnFinish | KpkTransaction::Modal, this); + QPointer reqFinder = new KpkTransaction(m_transactionReq, KpkTransaction::CloseOnFinish | KpkTransaction::Modal, this); reqFinder->exec(); + delete reqFinder; } else { removePackages(); } @@ -163,8 +166,9 @@ connect(m_transactionDep, SIGNAL(errorCode(PackageKit::Client::ErrorType, const QString &)), this, SLOT(errorCode(PackageKit::Client::ErrorType, const QString &))); // Create a Transaction dialog to don't upset the user - KpkTransaction* reqFinder = new KpkTransaction(m_transactionDep, KpkTransaction::Modal | KpkTransaction::CloseOnFinish, this); + QPointer reqFinder = new KpkTransaction(m_transactionDep, KpkTransaction::CloseOnFinish | KpkTransaction::Modal, this); reqFinder->exec(); + delete reqFinder; } else { installPackages(); } @@ -181,7 +185,7 @@ { kDebug() << "reqFinished"; if (status == Transaction::ExitSuccess) { - if (m_pkgModelReq->rowCount( QModelIndex() ) > 0) { + if (m_pkgModelReq->rowCount(QModelIndex()) > 0) { KpkRequirements *requimentD = new KpkRequirements(i18n("The following packages will also be removed for dependencies"), m_pkgModelReq, this); connect(requimentD, SIGNAL(okClicked()), this, SLOT(removePackages())); connect(requimentD, SIGNAL(cancelClicked()), this, SLOT(close())); @@ -202,6 +206,7 @@ void KpkReviewChanges::removePackages() { kDebug() << "removePackages"; + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); if (Transaction *t = m_client->removePackages(m_remPackages)) { KpkTransaction *frm = new KpkTransaction(t, KpkTransaction::CloseOnFinish | KpkTransaction::Modal, this); connect(frm, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)), @@ -239,6 +244,7 @@ void KpkReviewChanges::installPackages() { kDebug() << "installPackages"; + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); if ( Transaction *t = m_client->installPackages(m_addPackages) ) { KpkTransaction *frm = new KpkTransaction(t, KpkTransaction::CloseOnFinish | KpkTransaction::Modal, this); connect(frm, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)), @@ -268,6 +274,7 @@ break; case KpkTransaction::ReQueue : KpkTransaction *trans = (KpkTransaction *) sender(); + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); trans->setTransaction(m_client->removePackages(m_remPackages)); break; } @@ -288,6 +295,7 @@ break; case KpkTransaction::ReQueue : KpkTransaction *trans = (KpkTransaction *) sender(); + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); trans->setTransaction(m_client->installPackages(m_addPackages)); break; } diff -ruN kpackagekit/libkpackagekit/KpkReviewChanges.h kpackagekit-0.4.2/libkpackagekit/KpkReviewChanges.h --- kpackagekit/libkpackagekit/KpkReviewChanges.h 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkReviewChanges.h 2009-08-12 20:04:37.000000000 +0200 @@ -61,7 +61,7 @@ void checkChanged(); private: - KpkReviewChangesPrivate* d; + KpkReviewChangesPrivate *d; KpkPackageModel *m_pkgModelMain; KpkSimplePackageModel *m_pkgModelReq, *m_pkgModelDep; KpkDelegate *m_pkgDelegate; diff -ruN kpackagekit/libkpackagekit/KpkStrings.cpp kpackagekit-0.4.2/libkpackagekit/KpkStrings.cpp --- kpackagekit/libkpackagekit/KpkStrings.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkStrings.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -666,28 +666,28 @@ } else { switch (state) { case Package::StateLow : - return i18np("1 trivial update", "%1 trivial updates, %2 selected", updates, selected); + return i18np("%1 trivial update", "%1 trivial updates, %2 selected", updates, selected); case Package::StateNormal : return i18ncp("Type of update, in the case it's just an update", - "1 update", "%1 updates, %2 selected", updates, selected); + "%1 update", "%1 updates, %2 selected", updates, selected); case Package::StateImportant : - return i18np("1 important update", "%1 important updates, %2 selected", updates, selected); + return i18np("%1 important update", "%1 important updates, %2 selected", updates, selected); case Package::StateSecurity : - return i18np("1 security update", "%1 security updates, %2 selected", updates, selected); + return i18np("%1 security update", "%1 security updates, %2 selected", updates, selected); case Package::StateBugfix : - return i18np("1 bug fix update", "%1 bug fix updates, %2 selected", updates, selected); + return i18np("%1 bug fix update", "%1 bug fix updates, %2 selected", updates, selected); case Package::StateEnhancement : - return i18np("1 enhancement update", "%1 enhancement updates, %2 selected", updates, selected); + return i18np("%1 enhancement update", "%1 enhancement updates, %2 selected", updates, selected); case Package::StateBlocked : // Blocked updates aren't selectable - return i18np("1 blocked update", "%1 blocked updates", updates); + return i18np("%1 blocked update", "%1 blocked updates", updates); case Package::StateInstalled : - return i18np("1 installed package", "%1 installed packages, %2 selected to be removed", updates, selected); + return i18np("%1 installed package", "%1 installed packages, %2 selected to be removed", updates, selected); case Package::StateAvailable : - return i18np("1 available package", "%1 available packages, %2 selected to be installed", updates, selected); + return i18np("%1 available package", "%1 available packages, %2 selected to be installed", updates, selected); default : // In this case we don't want to map all enums kDebug() << "update info unrecognised: " << state; - return i18np("1 unknown update", "%1 unknown updates", updates); + return i18np("%1 unknown update", "%1 unknown updates", updates); } } } diff -ruN kpackagekit/libkpackagekit/KpkTransactionBar.cpp kpackagekit-0.4.2/libkpackagekit/KpkTransactionBar.cpp --- kpackagekit/libkpackagekit/KpkTransactionBar.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkTransactionBar.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -125,7 +125,7 @@ switch (status) { case Transaction::ExitSuccess: KColorScheme::adjustBackground(colors, KColorScheme::PositiveBackground, QPalette::Window, KColorScheme::Window); - m_label->setText(i18n("Finished in %1.", KGlobal::locale()->formatDuration(runtime))); + m_label->setText(i18n("Finished in %1.", KGlobal::locale()->prettyFormatDuration(runtime))); break; default: KColorScheme::adjustBackground(colors, KColorScheme::NegativeBackground, QPalette::Window, KColorScheme::Window); diff -ruN kpackagekit/libkpackagekit/KpkTransaction.cpp kpackagekit-0.4.2/libkpackagekit/KpkTransaction.cpp --- kpackagekit/libkpackagekit/KpkTransaction.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/KpkTransaction.cpp 2009-08-12 20:04:37.000000000 +0200 @@ -78,7 +78,7 @@ } // We need to track when the user close the dialog using the [X] button - connect(this, SIGNAL(/*finished*/()), SLOT(finishedDialog())); + connect(this, SIGNAL(finished()), SLOT(finishedDialog())); // after ALL set, lets set the transaction setTransaction(m_trans); @@ -200,53 +200,51 @@ void KpkTransaction::finishedDialog() { - slotButtonClicked(KDialog::User1); + if (!d->finished) { + // We are going to hide the transaction, + // which can make the user even close System Settings or KPackageKit + // so we call the tray icon to keep watching the transaction so if the + // transaction receives some error we can display them + QDBusMessage message; + message = QDBusMessage::createMethodCall("org.kde.KPackageKitSmartIcon", + "/", + "org.kde.KPackageKitSmartIcon", + QLatin1String("WatchTransaction")); + message << qVariantFromValue(m_trans->tid()); + QDBusMessage reply = QDBusConnection::sessionBus().call(message); + if (reply.type() != QDBusMessage::ReplyMessage) { + kWarning() << "Message did not receive a reply"; + } + // Always disconnect BEFORE emitting finished + m_trans->disconnect(); + emit kTransactionFinished(Success); + } } void KpkTransaction::slotButtonClicked(int button) { switch(button) { - case KDialog::Cancel : - kDebug() << "KDialog::Cancel"; - m_trans->cancel(); - m_flags |= CloseOnFinish; - break; - case KDialog::User1 : - kDebug() << "KDialog::User1"; - if (!d->finished) { - // We are going to hide the transaction, - // which can make the user even close System Settings or KPackageKit - // so we call the tray icon to keep watching the transaction so if the - // transaction receives some error we can display them - QDBusMessage message; - message = QDBusMessage::createMethodCall("org.kde.KPackageKitSmartIcon", - "/", - "org.kde.KPackageKitSmartIcon", - QLatin1String("WatchTransaction")); - message << qVariantFromValue(m_trans->tid()); - QDBusMessage reply = QDBusConnection::sessionBus().call(message); - if (reply.type() != QDBusMessage::ReplyMessage) { - kWarning() << "Message did not receive a reply"; - } - // Always disconnect BEFORE emitting finished - m_trans->disconnect(); - emit kTransactionFinished(Success); - } - // If you call Close it will - // come back to hunt you with Cancel - done(KDialog::User1); - break; - case KDialog::Close : - kDebug() << "KDialog::Close"; - // Always disconnect BEFORE emitting finished - m_trans->disconnect(); - emit kTransactionFinished(Cancelled); - done(KDialog::Close); - break; - case KDialog::Details : - d->showDetails = !d->showDetails; - default : // Should be only details - KDialog::slotButtonClicked(button); + case KDialog::Cancel : + kDebug() << "KDialog::Cancel"; + m_trans->cancel(); + m_flags |= CloseOnFinish; + break; + case KDialog::User1 : + kDebug() << "KDialog::User1"; + // when we're done finishedDialog() is called + done(KDialog::User1); + break; + case KDialog::Close : + kDebug() << "KDialog::Close"; + // Always disconnect BEFORE emitting finished + m_trans->disconnect(); + emit kTransactionFinished(Cancelled); + done(KDialog::Close); + break; + case KDialog::Details : + d->showDetails = !d->showDetails; + default : // Should be only details + KDialog::slotButtonClicked(button); } } @@ -344,10 +342,11 @@ m_handlingActionRequired = true; } - KpkLicenseAgreement *frm = new KpkLicenseAgreement(info, true, this); + QPointer frm = new KpkLicenseAgreement(info, true, this); if (frm->exec() == KDialog::Yes && Client::instance()->acceptEula(info)) { m_handlingActionRequired = false; } + delete frm; // Well try again, if fail will show the erroCode emit kTransactionFinished(ReQueue); @@ -388,12 +387,14 @@ m_handlingActionRequired = true; } - KpkRepoSig *frm = new KpkRepoSig(info, true, this); + QPointer frm = new KpkRepoSig(info, true, this); if (frm->exec() == KDialog::Yes && Client::instance()->installSignature(info.type, info.keyId, info.package)) { m_handlingActionRequired = false; } - kDebug() << "Requeue!"; + delete frm; + +// kDebug() << "Requeue!"; emit kTransactionFinished(ReQueue); } diff -ruN kpackagekit/libkpackagekit/version.h kpackagekit-0.4.2/libkpackagekit/version.h --- kpackagekit/libkpackagekit/version.h 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/libkpackagekit/version.h 2009-08-12 20:04:37.000000000 +0200 @@ -20,5 +20,5 @@ #ifndef KPKVERSION_H #define KPKVERSION_H -#define KPK_VERSION "0.4.0" +#define KPK_VERSION "0.4.2" #endif diff -ruN kpackagekit/Messages.sh kpackagekit-0.4.2/Messages.sh --- kpackagekit/Messages.sh 2009-05-21 20:49:16.000000000 +0200 +++ kpackagekit-0.4.2/Messages.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name "*.rc" -o -name "*.ui"` >> rc.cpp -$XGETTEXT `find . -name \*.cpp` -o $podir/kpackagekit.pot -rm -f rc.cpp - diff -ruN kpackagekit/po/bg/CMakeLists.txt kpackagekit-0.4.2/po/bg/CMakeLists.txt --- kpackagekit/po/bg/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ kpackagekit-0.4.2/po/bg/CMakeLists.txt 2009-08-12 20:06:10.000000000 +0200 @@ -0,0 +1,2 @@ +file(GLOB _po_files *.po) +GETTEXT_PROCESS_PO_FILES( bg ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} ${_po_files} ) diff -ruN kpackagekit/Settings/KcmKpkSettings.cpp kpackagekit-0.4.2/Settings/KcmKpkSettings.cpp --- kpackagekit/Settings/KcmKpkSettings.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/Settings/KcmKpkSettings.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -25,20 +25,26 @@ #include -K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin(); ) +K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin();) K_EXPORT_PLUGIN(KPackageKitFactory("kcm_kpk_settings")) KcmKpkSettings::KcmKpkSettings(QWidget *parent, const QVariantList &args) : KCModule(KPackageKitFactory::componentData(), parent, args) { - KGlobal::locale()->insertCatalog("kpackagekit"); - KAboutData *about = new KAboutData("kcm_kpk_settings", "kpackagekit", ki18n("KPackageKit Settings"), KPK_VERSION); - setAboutData(about); + KAboutData *aboutData; + aboutData = new KAboutData("kpackagekit", + "kpackagekit", + ki18n("KPackageKit settings"), + KPK_VERSION, + ki18n("KPackageKit settings"), + KAboutData::License_GPL, + ki18n("(C) 2008-2009 Daniel Nicoletti")); + setAboutData(aboutData); m_grid = new QGridLayout(this); view = new KpkSettings(this); - connect(this, SIGNAL(s_load()), view, SLOT(load()) ); - connect(this, SIGNAL(s_save()), view, SLOT(save()) ); - connect(this, SIGNAL(s_defaults()), view, SLOT(defaults()) ); - connect(view, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)) ); + connect(this, SIGNAL(s_load()), view, SLOT(load())); + connect(this, SIGNAL(s_save()), view, SLOT(save())); + connect(this, SIGNAL(s_defaults()), view, SLOT(defaults())); + connect(view, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); m_grid->addWidget(view); } diff -ruN kpackagekit/Settings/KpkSettings.cpp kpackagekit-0.4.2/Settings/KpkSettings.cpp --- kpackagekit/Settings/KpkSettings.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/Settings/KpkSettings.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -29,10 +29,10 @@ using namespace PackageKit; -KpkSettings::KpkSettings( QWidget *parent ) : -QWidget( parent ), m_originModel(0) +KpkSettings::KpkSettings(QWidget *parent) + : QWidget(parent), m_originModel(0) { - setupUi( this ); + setupUi(this); transactionBar->setBehaviors(KpkTransactionBar::AutoHide); Client::instance()->setLocale(KGlobal::locale()->language() + '.' + KGlobal::locale()->encoding()); @@ -122,7 +122,7 @@ int ret = intervalCB->findData(interval); if (ret == -1) { // this is if someone change the file by hand... - intervalCB->addItem(KGlobal::locale()->formatDuration(interval * 1000), interval); + intervalCB->addItem(KGlobal::locale()->prettyFormatDuration(interval * 1000), interval); intervalCB->setCurrentIndex(intervalCB->count() - 1); } else { intervalCB->setCurrentIndex(ret); diff -ruN kpackagekit/Settings/KpkSettings.h kpackagekit-0.4.2/Settings/KpkSettings.h --- kpackagekit/Settings/KpkSettings.h 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/Settings/KpkSettings.h 2009-08-12 20:04:35.000000000 +0200 @@ -33,7 +33,7 @@ Q_OBJECT public: - KpkSettings( QWidget *parent=0 ); + KpkSettings(QWidget *parent = 0); public slots: void load(); diff -ruN kpackagekit/SmartIcon/KPackageKitSmartIcon.cpp kpackagekit-0.4.2/SmartIcon/KPackageKitSmartIcon.cpp --- kpackagekit/SmartIcon/KPackageKitSmartIcon.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/KPackageKitSmartIcon.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -23,22 +23,6 @@ #include #include -// #include - -// enum KWorkSpace::ShutdownConfirm { KWorkSpace::ShutdownConfirmDefault = -1, KWorkSpace::ShutdownConfirmNo = 0, KWorkSpace::ShutdownConfirmYes = 1 } -// enum KWorkSpace::ShutdownMode { -// KWorkSpace::ShutdownModeDefault = -1, KWorkSpace::ShutdownModeSchedule = 0, KWorkSpace::ShutdownModeTryNow = 1, KWorkSpace::ShutdownModeForceNow = 2, -// KWorkSpace::ShutdownModeInteractive = 3 -// } -// enum KWorkSpace::ShutdownType { -// KWorkSpace::ShutdownTypeDefault = -1, KWorkSpace::ShutdownTypeNone = 0, KWorkSpace::ShutdownTypeReboot = 1, KWorkSpace::ShutdownTypeHalt = 2, -// KWorkSpace::ShutdownTypeLogout = 3 -// } -// -// -// 1 -// 1 -// 1 #define MINUTE 60000 using namespace kpackagekit; @@ -60,15 +44,18 @@ this, SLOT(close())); m_trayIcon = new KpkTransactionTrayIcon(this); - connect(m_trayIcon, SIGNAL(close()), this, SLOT(prepareToClose())); + connect(m_trayIcon, SIGNAL(close()), + this, SLOT(prepareToClose())); // This MUST be called after connecting all the signals or slots! QTimer::singleShot(0, m_trayIcon, SLOT(checkTransactionList())); m_updateIcon = new KpkUpdateIcon(this); - connect(m_updateIcon, SIGNAL(close()), this, SLOT(prepareToClose())); + connect(m_updateIcon, SIGNAL(close()), + this, SLOT(prepareToClose())); m_distroUpgrade = new KpkDistroUpgrade(this); - connect(m_distroUpgrade, SIGNAL(close()), this, SLOT(prepareToClose())); + connect(m_distroUpgrade, SIGNAL(close()), + this, SLOT(prepareToClose())); m_interface = new KpkInterface(this); // connect the update signal from DBus to our update and distro classes @@ -78,6 +65,8 @@ m_distroUpgrade, SLOT(checkDistroUpgrades())); m_transWatcher = new KpkTransactionWatcher(this); + connect(m_transWatcher, SIGNAL(close()), + this, SLOT(prepareToClose())); // connect the watch transaction coming through DBus to our watcher connect(m_interface, SIGNAL(watchTransaction(const QString &)), m_transWatcher, SLOT(watchTransaction(const QString &))); @@ -114,6 +103,10 @@ if (m_distroUpgrade && m_distroUpgrade->isRunning()) { return true; } + if (m_transWatcher && m_transWatcher->isRunning()) { + return true; + } + return false; } diff -ruN kpackagekit/SmartIcon/KpkDistroUpgrade.cpp kpackagekit-0.4.2/SmartIcon/KpkDistroUpgrade.cpp --- kpackagekit/SmartIcon/KpkDistroUpgrade.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/KpkDistroUpgrade.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -54,9 +54,8 @@ Q_UNUSED(type) kDebug() << "Distro upgrade found!" << name << description; increaseRunning(); - // TODO kde4.2 does not work with KNotification::Persistent, when it's fixed we move back - // otherwise we will leak - KNotification *notify = new KNotification("DistroUpgradeAvailable", 0, KNotification::CloseOnTimeout); + + KNotification *notify = new KNotification("DistroUpgradeAvailable", 0, KNotification::Persistent); QString text; text = i18n("Distribution upgrade available") + "
"; @@ -70,14 +69,14 @@ connect(notify, SIGNAL(activated(uint)), this, SLOT(handleDistroUpgradeAction(uint))); connect(notify, SIGNAL(closed()), - this , SLOT(handleDistroUpgradeActionClosed())); + this , SLOT(decreaseRunning())); notify->sendEvent(); } void KpkDistroUpgrade::handleDistroUpgradeAction(uint action) { // get the sender cause there might be more than one - KNotification *notify = (KNotification *) sender(); + KNotification *notify = qobject_cast(sender()); switch(action) { case 1: // Check to see if there isn't another process running @@ -102,12 +101,6 @@ notify->close(); } -void KpkDistroUpgrade::handleDistroUpgradeActionClosed() -{ - kDebug(); - decreaseRunning(); -} - void KpkDistroUpgrade::distroUpgradeFinished(int exitCode, QProcess::ExitStatus exitStatus) { decreaseRunning(); diff -ruN kpackagekit/SmartIcon/KpkDistroUpgrade.h kpackagekit-0.4.2/SmartIcon/KpkDistroUpgrade.h --- kpackagekit/SmartIcon/KpkDistroUpgrade.h 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/KpkDistroUpgrade.h 2009-08-12 20:04:35.000000000 +0200 @@ -42,7 +42,6 @@ void handleDistroUpgradeAction(uint action); void distroUpgradeError(QProcess::ProcessError error); void distroUpgradeFinished(int exitCode, QProcess::ExitStatus exitStatus); - void handleDistroUpgradeActionClosed(); private: QProcess *m_distroUpgradeProcess; diff -ruN kpackagekit/SmartIcon/KpkTransactionTrayIcon.cpp kpackagekit-0.4.2/SmartIcon/KpkTransactionTrayIcon.cpp --- kpackagekit/SmartIcon/KpkTransactionTrayIcon.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/KpkTransactionTrayIcon.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -24,20 +24,22 @@ #include #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include #include +#define RESTART_ICON_SIZE 64 + Q_DECLARE_METATYPE(Transaction*) KpkTransactionTrayIcon::KpkTransactionTrayIcon(QObject *parent) @@ -110,6 +112,7 @@ { increaseRunning(); // in this case refreshCache action must be clicked + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); if (Transaction *t = m_client->refreshCache(true)) { createTransactionDialog(t); } else { @@ -148,7 +151,6 @@ void KpkTransactionTrayIcon::createTransactionDialog(Transaction *t) { - kDebug(); increaseRunning(); // we need to close on finish otherwise smart-icon will timeout KpkTransaction *trans = new KpkTransaction(t, KpkTransaction::CloseOnFinish, m_menu); @@ -171,7 +173,7 @@ void KpkTransactionTrayIcon::transactionListChanged(const QList &tids) { - kDebug() << tids.size(); +// kDebug() << tids.size(); if (tids.size()) { setCurrentTransaction(tids.first()); } else { @@ -346,10 +348,16 @@ void KpkTransactionTrayIcon::requireRestart(PackageKit::Client::RestartType type, Package *pkg) { -// decreaseRunning(); //TODO make it persistent when kde fixes that + // Check if the type is NOT the most important restart type + if (type <= m_restartType) { + // we alread have the most important one + return; + } + + increaseRunning(); m_restartPackages << pkg->name(); - KNotification *notify = new KNotification("RestartRequired"); + KNotification *notify = new KNotification("RestartRequired", 0, KNotification::Persistent); QString text("" + i18n("The system update has completed") + ""); text.append("
" + KpkStrings::restartType(type)); notify->setText(text); @@ -357,15 +365,15 @@ QStringList actions; switch (type) { case Client::RestartSystem : - notify->setPixmap(KpkIcons::restartIcon(type).pixmap(64, 64)); - actions << i18n("Restart"); + notify->setPixmap(KpkIcons::restartIcon(type).pixmap(RESTART_ICON_SIZE, RESTART_ICON_SIZE)); + actions << i18nc("Restart the computer", "Restart"); actions << i18n("Not now"); m_restartType = Client::RestartSystem; m_restartAction->setIcon(KpkIcons::restartIcon(type)); - m_restartAction->setText(i18n("Restart")); + m_restartAction->setText(i18nc("Restart the computer", "Restart")); break; case Client::RestartSession : - notify->setPixmap(KpkIcons::restartIcon(type).pixmap(64, 64)); + notify->setPixmap(KpkIcons::restartIcon(type).pixmap(RESTART_ICON_SIZE, RESTART_ICON_SIZE)); actions << i18n("Logout"); actions << i18n("Not now"); if (m_restartType != Client::RestartSystem) { @@ -375,7 +383,7 @@ m_restartAction->setText(i18n("Logout")); break; case Client::RestartApplication : - notify->setPixmap(KpkIcons::restartIcon(type).pixmap(64, 64)); + notify->setPixmap(KpkIcons::restartIcon(type).pixmap(RESTART_ICON_SIZE, RESTART_ICON_SIZE)); // What do we do in restart application? // we don't even know what application is // SHOULD we check for pkg and see the installed @@ -391,6 +399,8 @@ notify->setActions(actions); connect(notify, SIGNAL(activated(uint)), this, SLOT(restartActivated(uint))); + connect(notify, SIGNAL(closed()), + this, SLOT(decreaseRunning())); notify->sendEvent(); } @@ -401,7 +411,7 @@ logout(); } // in persistent mode we need to manually close it -// notify->close(); + qobject_cast(sender())->close(); } void KpkTransactionTrayIcon::logout() diff -ruN kpackagekit/SmartIcon/KpkTransactionWatcher.cpp kpackagekit-0.4.2/SmartIcon/KpkTransactionWatcher.cpp --- kpackagekit/SmartIcon/KpkTransactionWatcher.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/KpkTransactionWatcher.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -21,11 +21,15 @@ #include "KpkTransactionWatcher.h" #include +#include #include #include +#include #include +Q_DECLARE_METATYPE(PackageKit::Client::ErrorType) + KpkTransactionWatcher::KpkTransactionWatcher(QObject *parent) : KpkAbstractIsRunning(parent) { @@ -40,14 +44,14 @@ foreach(Transaction *trans, m_hiddenTransactions) { if (trans->tid() == tid) { // Oops we are already watching this one - kDebug() << "Oops we are already watching this one" << tid; +// kDebug() << "Oops we are already watching this one" << tid; return; } } foreach(Transaction *trans, Client::instance()->getTransactions()) { if (trans->tid() == tid) { // found it let's start watching - kDebug() << "found it let's start watching" << tid; +// kDebug() << "found it let's start watching" << tid; m_hiddenTransactions.append(trans); connect(trans, SIGNAL(finished(PackageKit::Transaction::ExitStatus, uint)), this, SLOT(finished(PackageKit::Transaction::ExitStatus, uint))); @@ -63,7 +67,7 @@ foreach(Transaction *trans, m_hiddenTransactions) { if (trans->tid() == tid) { // Found it, let's remove - kDebug() << "found it let's remove" << tid; +// kDebug() << "found it let's remove" << tid; m_hiddenTransactions.removeOne(trans); // disconnect to not show any notification trans->disconnect(); @@ -82,48 +86,38 @@ void KpkTransactionWatcher::errorCode(PackageKit::Client::ErrorType err, const QString &details) { - Q_UNUSED(details) - KNotification* errorNotification = new KNotification("TransactionError"); - errorNotification->setFlags(KNotification::Persistent); - errorNotification->setText(""+KpkStrings::error(err)+"
"+KpkStrings::errorMessage(err)); - KIcon icon("dialog-error"); - // Use QSize for proper icon - errorNotification->setPixmap(icon.pixmap(QSize(128, 128))); - errorNotification->sendEvent(); -} - -// //FIXME: Implement the proper dbus calls to restart things. -// void KpkTransactionWatcher::showRestartMessage(PackageKit::Client::RestartType type, const QString &details) -// { -// if (type==Client::RestartNone) { -// return; -// } -// KNotification *notify = new KNotification("RestartRequired"); -// QString text; -// QStringList events; -// KIcon icon; -// switch(type) { -// case Client::RestartApplication: -// text = i18n("Restart the application for system changes to take effect."); -// //FIXME: Need a way to detect which program it is -// icon = KIcon("window-close"); -// break; -// case Client::RestartSession: -// text = i18n("You must logout and log back in for system changes to take effect."); -// icon = KIcon("system-restart"); //FIXME: find the logout icon -// break; -// case Client::RestartSystem: -// text = i18n("Please restart your computer for system changes to take effect."); -// icon = KIcon("system-restart"); -// break; -// case Client::RestartNone: -// case Client::UnknownRestartType: -// return; -// } -// // Use QSize for proper icon -// notify->setPixmap(icon.pixmap(QSize(128, 128))); -// notify->setText(""+text+"
"+details); -// notify->sendEvent(); -// } + increaseRunning(); + KNotification *notify = new KNotification("TransactionError", 0, KNotification::Persistent); + notify->setText(""+KpkStrings::error(err)+"
"+KpkStrings::errorMessage(err)); + notify->setProperty("ErrorType", QVariant::fromValue(err)); + notify->setProperty("Details", details); + QStringList actions; + actions << i18n("Details") << i18n("Ignore"); + notify->setActions(actions); + notify->setPixmap(KIcon("dialog-error").pixmap(64, 64)); + connect(notify, SIGNAL(activated(uint)), + this, SLOT(errorActivated(uint))); + connect(notify, SIGNAL(closed()), + this, SLOT(decreaseRunning())); + notify->sendEvent(); +} + +void KpkTransactionWatcher::errorActivated(uint action) +{ + KNotification *notify = qobject_cast(sender()); + // if the user clicked "Details" + if (action == 1) { + PackageKit::Client::ErrorType error = notify->property("ErrorType").value(); + QString details = notify->property("Details").toString(); + KMessageBox::detailedSorry(0, + KpkStrings::errorMessage(error), + QString(details).replace('\n', "
"), + KpkStrings::error(error), + KMessageBox::Notify); + } + + // in persistent mode we need to manually close it + notify->close(); +} #include "KpkTransactionWatcher.moc" diff -ruN kpackagekit/SmartIcon/KpkTransactionWatcher.h kpackagekit-0.4.2/SmartIcon/KpkTransactionWatcher.h --- kpackagekit/SmartIcon/KpkTransactionWatcher.h 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/KpkTransactionWatcher.h 2009-08-12 20:04:35.000000000 +0200 @@ -41,7 +41,7 @@ private slots: void errorCode(PackageKit::Client::ErrorType, const QString&); -// void showRestartMessage(PackageKit::Client::RestartType, const QString&); + void errorActivated(uint action); void finished(PackageKit::Transaction::ExitStatus status, uint time); private: diff -ruN kpackagekit/SmartIcon/KpkUpdateIcon.cpp kpackagekit-0.4.2/SmartIcon/KpkUpdateIcon.cpp --- kpackagekit/SmartIcon/KpkUpdateIcon.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/KpkUpdateIcon.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -27,10 +27,13 @@ #include #include -#include #include #include #include +#include + +#include + #include using namespace PackageKit; @@ -52,9 +55,9 @@ // this, SLOT(showSettings())); // m_icon->contextMenu()->addAction(m_icon->actionCollection()->action(KStandardAction::name(KStandardAction::Preferences))); - int m_inhibitCookie = Solid::PowerManagement::beginSuppressingSleep( i18n("Installing updates.") ); - if (m_inhibitCookie == -1) - kDebug() << "Sleep suppression denied!"; +// int m_inhibitCookie = Solid::PowerManagement::beginSuppressingSleep( i18n("Installing updates.") ); +// if (m_inhibitCookie == -1) +// kDebug() << "Sleep suppression denied!"; } KpkUpdateIcon::~KpkUpdateIcon() @@ -156,17 +159,13 @@ foreach(Package *p, m_updateList) { packageGroups[p->state()].append(p); - } - - foreach(const Package::State &state, packageGroups.keys()) { - if (state>highState) { - highState = state; + if (p->state() > highState) { + highState = p->state(); } } KIcon icon = KpkIcons::packageIcon(highState); - // FIXME persistent does not work in 4.2 anymore, remove the comments when it's fixed - m_updateNotify = new KNotification("ShowUpdates"/*, 0, KNotification::Persistent*/); + m_updateNotify = new KNotification("ShowUpdates", 0, KNotification::Persistent); // use of QSize does the right thing m_updateNotify->setPixmap(icon.pixmap(QSize(128,128))); @@ -204,7 +203,7 @@ { Q_UNUSED(runtime) if (m_updateList.size() > 0) { - kDebug() << "Found " << m_updateList.size() << " updates"; +// kDebug() << "Found " << m_updateList.size() << " updates"; Package::State highState = Package::StateInstalled; //FIXME: This assumes that PackageKit shares our priority ranking. foreach(Package *p, m_updateList) { @@ -219,11 +218,12 @@ KConfigGroup checkUpdateGroup(&config, "CheckUpdate"); uint updateType = (uint) checkUpdateGroup.readEntry("autoUpdate", KpkEnum::AutoUpdateDefault); if (updateType == KpkEnum::None) { - kDebug() << "None."; +// kDebug() << "None."; notifyUpdates(); } else { if (updateType == KpkEnum::All) { - kDebug() << "All"; +// kDebug() << "All"; + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); if (Transaction* t = Client::instance()->updateSystem()) { connect(t, SIGNAL(finished(PackageKit::Transaction::ExitStatus, uint)), this, SLOT(updatesFinished(PackageKit::Transaction::ExitStatus, uint))); @@ -237,12 +237,12 @@ autoInstallNotify->sendEvent(); increaseRunning(); } else { - kDebug() << "All Trans failed."; +// kDebug() << "All Trans failed."; notifyUpdates(); } } else { // Defaults to security - kDebug() << "Security"; +// kDebug() << "Security"; QList updateList; foreach(PackageKit::Package *package, m_updateList) { if (package->state() == Package::StateSecurity) { @@ -250,6 +250,7 @@ } } if (updateList.size() > 0) { + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); if (Transaction *t = Client::instance()->updatePackages(updateList)) { // suppressSleep(true); connect(t, SIGNAL(finished(PackageKit::Transaction::ExitStatus, uint)), @@ -263,11 +264,11 @@ autoInstallNotify->sendEvent(); increaseRunning(); } else { - kDebug() << "security Trans failed."; +// kDebug() << "security Trans failed."; notifyUpdates(); } } else { - kDebug() << "No security updates."; +// kDebug() << "No security updates."; notifyUpdates(); } } @@ -303,7 +304,7 @@ void KpkUpdateIcon::handleUpdateAction(uint action) { - qDebug() << "action" << action; +// kDebug() << "action" << action; switch(action) { case 1: showUpdates(); @@ -325,7 +326,7 @@ void KpkUpdateIcon::handleUpdateActionClosed() { - kDebug(); +// kDebug(); m_updateNotify = 0; decreaseRunning(); } diff -ruN kpackagekit/SmartIcon/main.cpp kpackagekit-0.4.2/SmartIcon/main.cpp --- kpackagekit/SmartIcon/main.cpp 2009-05-21 20:49:11.000000000 +0200 +++ kpackagekit-0.4.2/SmartIcon/main.cpp 2009-08-12 20:04:35.000000000 +0200 @@ -50,6 +50,5 @@ } kpackagekit::KPackageKit_Smart_Icon app; - app.exec(); - return 0; + return app.exec(); } diff -ruN kpackagekit/Updater/CMakeLists.txt kpackagekit-0.4.2/Updater/CMakeLists.txt --- kpackagekit/Updater/CMakeLists.txt 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/Updater/CMakeLists.txt 2009-08-12 20:04:36.000000000 +0200 @@ -14,6 +14,12 @@ ) kde4_add_plugin(kcm_kpk_update ${kpk_update_SRCS}) -target_link_libraries(kcm_kpk_update ${KDE4_KDEUI_LIBS} ${QPACKAGEKIT_LIBRARIES} ${KDE4_SOLID_LIBS} kpackagekitlib) +target_link_libraries(kcm_kpk_update + ${KDE4_KDEUI_LIBS} + ${KDE4_KIO_LIBS} + ${KDE4_SOLID_LIBS} + ${QPACKAGEKIT_LIBRARIES} + kpackagekitlib +) install(TARGETS kcm_kpk_update DESTINATION ${PLUGIN_INSTALL_DIR} ) diff -ruN kpackagekit/Updater/KcmKpkUpdate.cpp kpackagekit-0.4.2/Updater/KcmKpkUpdate.cpp --- kpackagekit/Updater/KcmKpkUpdate.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/Updater/KcmKpkUpdate.cpp 2009-08-12 20:04:36.000000000 +0200 @@ -25,15 +25,21 @@ #include -K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin(); ) +K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin();) K_EXPORT_PLUGIN(KPackageKitFactory("kcm_kpk_update")) KcmKpkUpdate::KcmKpkUpdate(QWidget *&parent, const QVariantList &args) : KCModule(KPackageKitFactory::componentData(), parent, args) { - KGlobal::locale()->insertCatalog("kpackagekit"); - KAboutData *about = new KAboutData("kcm_kpk_update", "kpackagekit", ki18n("KPackageKit Update"), KPK_VERSION); - setAboutData(about); + KAboutData *aboutData; + aboutData = new KAboutData("kpackagekit", + "kpackagekit", + ki18n("Software update"), + KPK_VERSION, + ki18n("KDE interface for updating software"), + KAboutData::License_GPL, + ki18n("(C) 2008-2009 Daniel Nicoletti")); + setAboutData(aboutData); setButtons(Apply); m_grid = new QGridLayout(this); view = new KpkUpdate(this); diff -ruN kpackagekit/Updater/KpkHistory.cpp kpackagekit-0.4.2/Updater/KpkHistory.cpp --- kpackagekit/Updater/KpkHistory.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/Updater/KpkHistory.cpp 2009-08-12 20:04:36.000000000 +0200 @@ -89,7 +89,7 @@ } QString text; uint time = Client::instance()->getTimeSinceAction(Client::ActionRefreshCache) * 1000; - text = i18n("Time since last cache refresh: %1", KGlobal::locale()->formatDuration(time)); + text = i18n("Time since last cache refresh: %1", KGlobal::locale()->prettyFormatDuration(time)); timeCacheLabel->setText(text); } diff -ruN kpackagekit/Updater/KpkUpdate.cpp kpackagekit-0.4.2/Updater/KpkUpdate.cpp --- kpackagekit/Updater/KpkUpdate.cpp 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/Updater/KpkUpdate.cpp 2009-08-12 20:04:36.000000000 +0200 @@ -22,13 +22,18 @@ #include "KpkUpdateDetails.h" #include "KpkDistroUpgrade.h" #include "KpkHistory.h" + #include #include +#include +#include +#include +#include +#include -#include #include - -#include +#include +#include #define UNIVERSAL_PADDING 6 @@ -37,7 +42,8 @@ { setupUi(this); - updatePB->setIcon(KpkIcons::getIcon("package-update")); + m_dependsPkgModel = new KpkSimplePackageModel(this); + selectAllPB->setIcon(KpkIcons::getIcon("package-update")); refreshPB->setIcon(KpkIcons::getIcon("view-refresh")); historyPB->setIcon(KpkIcons::getIcon("view-history")); transactionBar->setBehaviors(KpkTransactionBar::AutoHide); @@ -83,17 +89,14 @@ void KpkUpdate::checkEnableUpdateButton() { - if (m_pkg_model_updates->selectedPackages().size() > 0) { - emit changed(true); - } else { - emit changed(false); - } + emit changed(m_pkg_model_updates->selectedPackages().size() > 0); + // if we don't have any upates let's disable the button + selectAllPB->setEnabled(m_pkg_model_updates->rowCount() != 0); } -void KpkUpdate::on_updatePB_clicked() +void KpkUpdate::on_selectAllPB_clicked() { m_pkg_model_updates->checkAll(); - applyUpdates(); } void KpkUpdate::load() @@ -103,56 +106,85 @@ void KpkUpdate::applyUpdates() { - QList packages = m_pkg_model_updates->selectedPackages(); - //check to see if the user selected all selectable packages - if (m_pkg_model_updates->allSelected()) { - // if so let's do system-update instead - if (Transaction *t = m_client->updateSystem()) { - KpkTransaction *frm = new KpkTransaction(t, KpkTransaction::Modal | KpkTransaction::CloseOnFinish, this); - connect(frm, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)), - this, SLOT(displayUpdates(KpkTransaction::ExitStatus))); - frm->show(); - } else { - KMessageBox::sorry(this, - i18n("You do not have the necessary privileges to perform this action."), - i18n("Failed to update system")); - } + // If the backend supports getRequires do it + if (m_actions & Client::ActionGetRequires) { + + PackageKit::Transaction *dependsT; + dependsT = m_client->getDepends(m_pkg_model_updates->selectedPackages(), Client::FilterNotInstalled, true); + m_dependsPkgModel->clear(); + connect(dependsT, SIGNAL(package(PackageKit::Package *)), + m_dependsPkgModel, SLOT(addPackage(PackageKit::Package *))); + connect(dependsT, SIGNAL(finished(PackageKit::Transaction::ExitStatus, uint)), + this, SLOT(getDependsFinished(PackageKit::Transaction::ExitStatus, uint))); + connect(dependsT, SIGNAL(errorCode(PackageKit::Client::ErrorType, const QString &)), + this, SLOT(errorCode(PackageKit::Client::ErrorType, const QString &))); + + // Create a Transaction dialog to don't upset the user + QPointer reqFinder = new KpkTransaction(dependsT, KpkTransaction::CloseOnFinish | KpkTransaction::Modal, this); + reqFinder->exec(); + delete reqFinder; } else { - // else lets install only the selected ones - if (Transaction *t = m_client->updatePackages(packages)) { - KpkTransaction *frm = new KpkTransaction(t, KpkTransaction::Modal | KpkTransaction::CloseOnFinish, this); - connect(frm, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)), - this, SLOT(displayUpdates(KpkTransaction::ExitStatus))); - frm->show(); + updatePackages(); + } +} + +void KpkUpdate::getUpdatesFinished(Transaction::ExitStatus status, uint runtime) +{ + Q_UNUSED(status) + Q_UNUSED(runtime) + + // If we just have one group let's expand it + if (m_pkg_model_updates->rowCount() == 1) { + packageView->expandAll(); + } + checkEnableUpdateButton(); +} + +void KpkUpdate::getDependsFinished(PackageKit::Transaction::ExitStatus status, uint runtime) +{ + Q_UNUSED(status) + Q_UNUSED(runtime) + + if (status == Transaction::ExitSuccess) { + if (m_dependsPkgModel->rowCount(QModelIndex()) > 0) { + KpkRequirements *requimentD = new KpkRequirements(i18n("The following packages will also be installed as dependencies"), m_dependsPkgModel, this); + connect(requimentD, SIGNAL(okClicked()), this, SLOT(updatePackages())); + requimentD->show(); } else { - KMessageBox::sorry(this, - i18n("You do not have the necessary privileges to perform this action."), - i18n("Failed to update package lists")); + updatePackages(); } } + } -void KpkUpdate::refresh() +void KpkUpdate::updatePackages() { - if ( Transaction *t = m_client->refreshCache(true) ) { + QList packages = m_pkg_model_updates->selectedPackages(); + Client::instance()->setProxy(KProtocolManager::proxyFor("http"), KProtocolManager::proxyFor("ftp")); + + if (Transaction *t = m_client->updatePackages(packages)) { KpkTransaction *frm = new KpkTransaction(t, KpkTransaction::Modal | KpkTransaction::CloseOnFinish, this); connect(frm, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)), - this, SLOT(displayUpdates(KpkTransaction::ExitStatus))); + this, SLOT(displayUpdates(KpkTransaction::ExitStatus))); frm->show(); } else { KMessageBox::sorry(this, i18n("You do not have the necessary privileges to perform this action."), - i18n("Failed to refresh package lists")); + i18n("Failed to update package lists")); } } -void KpkUpdate::getUpdatesFinished(Transaction::ExitStatus status, uint runtime) +void KpkUpdate::refresh() { - Q_UNUSED(status) - Q_UNUSED(runtime) - // If we just have one group let's expand it - if (m_pkg_model_updates->rowCount() == 1) { - packageView->expandAll(); + if ( Transaction *t = m_client->refreshCache(true) ) { + KpkTransaction *frm = new KpkTransaction(t, KpkTransaction::Modal | KpkTransaction::CloseOnFinish, this); + connect(frm, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)), + this, SLOT(displayUpdates(KpkTransaction::ExitStatus))); + frm->show(); + } else { + KMessageBox::sorry(this, + i18n("You do not have the necessary privileges to perform this action."), + i18n("Failed to refresh package lists")); } } @@ -211,7 +243,7 @@ void KpkUpdate::on_historyPB_clicked() { - KpkHistory *frm = new KpkHistory(this); + QPointer frm = new KpkHistory(this); frm->exec(); delete frm; } diff -ruN kpackagekit/Updater/KpkUpdate.h kpackagekit-0.4.2/Updater/KpkUpdate.h --- kpackagekit/Updater/KpkUpdate.h 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/Updater/KpkUpdate.h 2009-08-12 20:04:36.000000000 +0200 @@ -23,14 +23,14 @@ #include -#include "KpkPackageModel.h" #include -#include - #include #include "ui_KpkUpdate.h" +class KpkPackageModel; +class KpkSimplePackageModel; +class KpkDelegate; class KProgressDialog; using namespace PackageKit; @@ -50,7 +50,7 @@ void refresh(); private slots: - void on_updatePB_clicked(); + void on_selectAllPB_clicked(); void on_refreshPB_clicked(); void on_historyPB_clicked(); @@ -58,6 +58,8 @@ void displayUpdates(KpkTransaction::ExitStatus status); void getUpdatesFinished(PackageKit::Transaction::ExitStatus status, uint runtime); + void getDependsFinished(PackageKit::Transaction::ExitStatus status, uint runtime); + void updatePackages(); void updateColumnsWidth(bool force = false); void on_packageView_pressed(const QModelIndex &index); @@ -67,6 +69,8 @@ private: KpkPackageModel *m_pkg_model_updates; + KpkSimplePackageModel *m_dependsPkgModel; + KpkDelegate *pkg_delegate; Client *m_client; Transaction *m_updatesT; diff -ruN kpackagekit/Updater/KpkUpdate.ui kpackagekit-0.4.2/Updater/KpkUpdate.ui --- kpackagekit/Updater/KpkUpdate.ui 2009-05-21 20:49:12.000000000 +0200 +++ kpackagekit-0.4.2/Updater/KpkUpdate.ui 2009-08-12 20:04:36.000000000 +0200 @@ -1,7 +1,8 @@ - + + KpkUpdate - - + + 0 0 @@ -9,100 +10,100 @@ 423 - - + + - - + + 0 - - - - + + + + 0 0 - + Qt::ScrollBarAlwaysOff - + false - + false - + true - + true - + true - + true - + false - + false - + false - + true - - + + - - + + - - - Apply all available updates + + + Select all updates - - + + Refresh - - + + History - - - + + + 16777215 100 - + QFrame::Sunken - + true - - + + 0 0 @@ -110,13 +111,13 @@ 94 - + - - - + + + Qt::Horizontal @@ -132,7 +133,7 @@ KpkTransactionBar QWidget -
KpkTransactionBar.h
+
KpkTransactionBar.h
1