From ec8dcd1c5e1245b95513b796f16edcef619c54c8 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Fri, 4 Jul 2008 22:53:59 -0300 Subject: Changed the nick stuff and add some code to polkitClient that is NOT working... need a fix --- AUTHORS | 2 +- MAINTAINERS | 2 +- gui/AddRm/CMakeLists.txt | 8 +-- gui/AddRm/PkAddRm.cpp | 2 +- gui/AddRm/PkAddRm.h | 2 +- gui/AddRm/PkRequirements.cpp | 2 +- gui/AddRm/PkRequirements.h | 2 +- gui/AddRm/PkReviewChanges.cpp | 5 +- gui/AddRm/PkReviewChanges.h | 2 +- gui/AddRm/PkTransaction.cpp | 133 -------------------------------------- gui/AddRm/PkTransaction.h | 57 ---------------- gui/AddRm/PkTransaction.ui | 108 ------------------------------- gui/AddRm/kpk-addrm.cpp | 2 +- gui/AddRm/kpk-addrm.h | 2 +- gui/CMakeLists.txt | 3 +- gui/Common/PkStrings.cpp | 2 +- gui/Common/PkStrings.h | 2 +- gui/KPackageKitD/CMakeLists.txt | 4 +- gui/KPackageKitD/kpackagekitd.cpp | 22 +++---- gui/KPackageKitD/kpackagekitd.h | 2 +- gui/Settings/CMakeLists.txt | 2 +- gui/Settings/PkConfigSkell.cpp | 2 +- gui/Settings/PkConfigSkell.h | 2 +- gui/Settings/PkSettings.cpp | 2 +- gui/Settings/PkSettings.h | 2 +- gui/Settings/kpk-settings.cpp | 2 +- gui/Settings/kpk-settings.h | 2 +- gui/Updater/CMakeLists.txt | 7 +- gui/Updater/PkAddRm_Delegate.cpp | 2 +- gui/Updater/PkAddRm_Delegate.h | 2 +- gui/Updater/PkUpdate.cpp | 14 +++- gui/Updater/PkUpdate.h | 2 +- gui/Updater/kpk-update.cpp | 2 +- gui/Updater/kpk-update.h | 2 +- lib/PolkitClient.cpp | 37 +++++++++-- lib/Transaction.cpp | 8 +-- 36 files changed, 97 insertions(+), 357 deletions(-) delete mode 100755 gui/AddRm/PkTransaction.cpp delete mode 100755 gui/AddRm/PkTransaction.h delete mode 100644 gui/AddRm/PkTransaction.ui diff --git a/AUTHORS b/AUTHORS index 725eaa2..fff4831 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,2 @@ Adrien BUSTANY -Daniel Nicoletti +Daniel Nicoletti diff --git a/MAINTAINERS b/MAINTAINERS index caa529b..e68388a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1,2 +1,2 @@ Adrien BUSTANY -Daniel Nicoletti \ No newline at end of file +Daniel Nicoletti \ No newline at end of file diff --git a/gui/AddRm/CMakeLists.txt b/gui/AddRm/CMakeLists.txt index cb4931a..3d6c676 100644 --- a/gui/AddRm/CMakeLists.txt +++ b/gui/AddRm/CMakeLists.txt @@ -4,7 +4,7 @@ set(kpk_addrm_SRCS PkAddRm_Model.cpp PkDelegate.cpp PkReviewChanges.cpp - PkTransaction.cpp + ../Common/PkTransaction.cpp PkRequirements.cpp ../Common/PkStrings.cpp ) @@ -12,11 +12,11 @@ set(kpk_addrm_SRCS kde4_add_ui_files(kpk_addrm_SRCS PkAddRm.ui PkReviewChanges.ui - PkTransaction.ui + ../Common/PkTransaction.ui PkRequirements.ui ) kde4_add_plugin(kcm_kpk_addrm ${kpk_addrm_SRCS}) -target_link_libraries(kcm_kpk_addrm ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KNEWSTUFF2_LIBS} ${QPACKAGEKIT_LIB} ) +target_link_libraries(kcm_kpk_addrm ${KDE4_KDEUI_LIBS} ${QPACKAGEKIT_LIB}) -install(TARGETS kcm_kpk_addrm DESTINATION ${PLUGIN_INSTALL_DIR} ) \ No newline at end of file +install(TARGETS kcm_kpk_addrm DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/gui/AddRm/PkAddRm.cpp b/gui/AddRm/PkAddRm.cpp index 579d0c9..eed3f6c 100755 --- a/gui/AddRm/PkAddRm.cpp +++ b/gui/AddRm/PkAddRm.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/AddRm/PkAddRm.h b/gui/AddRm/PkAddRm.h index c91b1df..e7acdf2 100755 --- a/gui/AddRm/PkAddRm.h +++ b/gui/AddRm/PkAddRm.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/AddRm/PkRequirements.cpp b/gui/AddRm/PkRequirements.cpp index 8cc0704..fbb8447 100755 --- a/gui/AddRm/PkRequirements.cpp +++ b/gui/AddRm/PkRequirements.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/AddRm/PkRequirements.h b/gui/AddRm/PkRequirements.h index 691ed9b..db4819a 100755 --- a/gui/AddRm/PkRequirements.h +++ b/gui/AddRm/PkRequirements.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/AddRm/PkReviewChanges.cpp b/gui/AddRm/PkReviewChanges.cpp index 91ee5b4..1f11443 100755 --- a/gui/AddRm/PkReviewChanges.cpp +++ b/gui/AddRm/PkReviewChanges.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * @@ -22,7 +22,7 @@ #include #include "PkRequirements.h" -#include "PkTransaction.h" +#include "../Common/PkTransaction.h" #include "PkReviewChanges.h" #define UNIVERSAL_PADDING 6 @@ -184,7 +184,6 @@ void PkReviewChanges::removePackages() if ( m_trans->removePackages(m_remPackages) ) { PkTransaction *frm = new PkTransaction(m_trans, i18n("Remove Packages"), this); connect( frm, SIGNAL( Finished(bool) ), this, SLOT( remFinished(bool) ) ); - m_trans->removePackages(m_remPackages); frm->show(); } else diff --git a/gui/AddRm/PkReviewChanges.h b/gui/AddRm/PkReviewChanges.h index f18971a..62fc62c 100755 --- a/gui/AddRm/PkReviewChanges.h +++ b/gui/AddRm/PkReviewChanges.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/AddRm/PkTransaction.cpp b/gui/AddRm/PkTransaction.cpp deleted file mode 100755 index 2f36756..0000000 --- a/gui/AddRm/PkTransaction.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-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; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include -#include - -#include "../Common/PkStrings.h" -#include "PkTransaction.h" - -PkTransaction::PkTransaction( Transaction *trans, QString caption, QWidget *parent ) - : KDialog(parent), m_trans(trans) -{ - setupUi( mainWidget() ); - setCaption( caption ); - - connect( m_trans, SIGNAL( GotPackage(Package *) ), this, SLOT( currPackage(Package *) ) ); - connect( m_trans, SIGNAL( Finished(Exit::Value, uint) ), this, SLOT( Finished(Exit::Value, uint) ) ); - connect( m_trans, SIGNAL( AllowCancel(bool) ), this, SLOT( enableButtonCancel(bool) ) ); - connect( m_trans, SIGNAL( ErrorCode(Error::Value, const QString&) ), this, SLOT( ErrorCode(Error::Value, const QString&) ) ); - connect( m_trans, SIGNAL( ProgressChanged(uint, uint, uint, uint) ), this, SLOT( ProgressChanged(uint, uint, uint, uint) ) ); - connect( m_trans, SIGNAL( StatusChanged(Status::Value) ), this, SLOT( StatusChanged(Status::Value) ) ); - - // Set Cancel and custom buoton hide - setButtons( KDialog::Cancel | KDialog::User1 ); - setButtonText( KDialog::User1, i18n("Hide") ); - setButtonToolTip( KDialog::User1, i18n("Allows you to hide the window but keeps running transaction task") ); - enableButtonCancel(false); - - m_pbTimer = new QTimer(this); - connect(m_pbTimer, SIGNAL(timeout()), this, SLOT(updateProgress() )); - m_pbTimer->start(5); - setModal(true); - - // set wait msg - currentL->setText( i18n("Please Wait..." ) ); -} - -void PkTransaction::updateProgress() -{ - progressBar->setValue(progressBar->value() + 1); -} - -void PkTransaction::ProgressChanged(uint percentage, uint /*subpercentage*/, uint /*elapsed*/, uint /*remaining*/) -{ - m_pbTimer->stop(); - progressBar->setMaximum(100); - progressBar->setValue(percentage); -} - -void PkTransaction::currPackage(Package *p) -{ - packageL->setText( p->name() + " - " + p->version() + " (" + p->arch() + ")" ); - descriptionL->setText( p->summary() ); -} - -void PkTransaction::slotButtonClicked(int button) -{ - switch(button) { - case KDialog::Cancel : - m_trans->cancel(); - break; - case KDialog::User1 : - emit Finished(false); - KDialog::slotButtonClicked(KDialog::Close); - break; - case KDialog::Close : - emit Finished(true); - KDialog::slotButtonClicked(KDialog::Close); - break; - default : - KDialog::slotButtonClicked(button); - } -} - -PkTransaction::~PkTransaction() -{ - -} - -void PkTransaction::StatusChanged(Status::Value v) -{ - currentL->setText( PkStrings::StatusChanged(v) ); -} - -void PkTransaction::ErrorCode(Error::Value v, const QString &details) -{ - KMessageBox::detailedSorry( this, PkStrings::ErrorMessage(v), details, PkStrings::Error(v), KMessageBox::Notify ); -} - -void PkTransaction::Finished(Exit::Value status, uint /*runtime*/) -{ - qDebug() << "trans finished: " << status ; - switch(status) { - case Exit::Success : - qDebug() << "trans succes: "; - emit Finished(false); - KDialog::slotButtonClicked(KDialog::Close); - break; - case Exit::Failed : - qDebug() << "trans failed: "; - setButtons( KDialog::Close ); - break; - case Exit::Kill : - qDebug() << "trans quit: "; - break; - case Exit::Cancelled : - qDebug() << "trans cancelled: "; - setButtons( KDialog::Close ); - break; - case Exit::Unknown : - qDebug() << "trans quit: "; - break; - } -} - -#include "PkTransaction.moc" diff --git a/gui/AddRm/PkTransaction.h b/gui/AddRm/PkTransaction.h deleted file mode 100755 index 27982ad..0000000 --- a/gui/AddRm/PkTransaction.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-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; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef PKTRANSACTION_H -#define PKTRANSACTION_H - -#include - -#include "ui_PkTransaction.h" -#include - -using namespace PackageKit; - -class PkTransaction : public KDialog, Ui::PkTransaction -{ - Q_OBJECT -public: - PkTransaction( Transaction *trans, QString caption, QWidget *parent=0); - ~PkTransaction(); - -signals: - void Finished(bool error); - -private: - Transaction *m_trans; - QTimer *m_pbTimer; - -private slots: - void Finished(Exit::Value status, uint runtime); - void ErrorCode(Error::Value v, const QString &details); - void StatusChanged(Status::Value v); - void currPackage(Package *); - void updateProgress(); - void ProgressChanged(uint percentage, uint subpercentage, uint elapsed, uint remaining); - -protected slots: - virtual void slotButtonClicked(int button); -}; - -#endif diff --git a/gui/AddRm/PkTransaction.ui b/gui/AddRm/PkTransaction.ui deleted file mode 100644 index 399644a..0000000 --- a/gui/AddRm/PkTransaction.ui +++ /dev/null @@ -1,108 +0,0 @@ - - PkTransaction - - - Qt::NonModal - - - - 0 - 0 - 400 - 106 - - - - - 0 - 0 - - - - - 360 - 0 - - - - KPackageKit - Transaction - - - - - - - - - - 12 - 75 - true - - - - - - - - - - Qt::AlignCenter - - - - - - - - - - 0 - - - - - - - - 75 - true - - - - - - - - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - diff --git a/gui/AddRm/kpk-addrm.cpp b/gui/AddRm/kpk-addrm.cpp index 041d760..28a2d71 100644 --- a/gui/AddRm/kpk-addrm.cpp +++ b/gui/AddRm/kpk-addrm.cpp @@ -1,5 +1,5 @@ /* This file is part of the KDE project - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 diff --git a/gui/AddRm/kpk-addrm.h b/gui/AddRm/kpk-addrm.h index d4a5674..6833c61 100644 --- a/gui/AddRm/kpk-addrm.h +++ b/gui/AddRm/kpk-addrm.h @@ -1,5 +1,5 @@ /* This file is part of the KDE project - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 9a41985..3427f16 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -7,8 +7,9 @@ find_package(QPackageKit REQUIRED) include(KDE4Defaults) add_definitions(${QT_DEFINITIONS} ${KDE_DEFINITIONS}) -include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDE4_KIO_INCLUDES} ${QPACKAGEKIT_INCLUDE_DIR} ) +include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${QPACKAGEKIT_INCLUDE_DIR} ) +#${KDE4_KIO_INCLUDES} add_subdirectory( AddRm ) add_subdirectory( Settings ) add_subdirectory( Updater ) diff --git a/gui/Common/PkStrings.cpp b/gui/Common/PkStrings.cpp index 6b9ebf2..9d03a07 100755 --- a/gui/Common/PkStrings.cpp +++ b/gui/Common/PkStrings.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/Common/PkStrings.h b/gui/Common/PkStrings.h index 45651f9..a3d568e 100755 --- a/gui/Common/PkStrings.h +++ b/gui/Common/PkStrings.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/KPackageKitD/CMakeLists.txt b/gui/KPackageKitD/CMakeLists.txt index 9d5ad2a..28fe32f 100644 --- a/gui/KPackageKitD/CMakeLists.txt +++ b/gui/KPackageKitD/CMakeLists.txt @@ -2,6 +2,6 @@ set(kded_kpackagekitd_SRCS kpackagekitd.cpp) kde4_add_plugin(kded_kpackagekitd ${kded_kpackagekitd_SRCS}) -target_link_libraries(kded_kpackagekitd ${KDE4_KIO_LIBS}) +target_link_libraries(kded_kpackagekitd ${KDE4_KIO_LIBS} ${QPACKAGEKIT_LIB}) -install(TARGETS kded_kpackagekitd DESTINATION ${PLUGIN_INSTALL_DIR}) \ No newline at end of file +install(TARGETS kded_kpackagekitd DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/gui/KPackageKitD/kpackagekitd.cpp b/gui/KPackageKitD/kpackagekitd.cpp index 90d670c..eb94a09 100644 --- a/gui/KPackageKitD/kpackagekitd.cpp +++ b/gui/KPackageKitD/kpackagekitd.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * @@ -18,7 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include +#include #include #include #include @@ -34,7 +34,7 @@ KPackageKit::KPackageKit(QObject *parent, const QList&) : KDEDModule(parent) { m_qtimer = new QTimer(this); - connect(m_qtimer, SIGNAL(timeout()), this, SLOT(init())); + connect( m_qtimer, SIGNAL( timeout() ), this, SLOT( init() ) ) ; // Start after 10 minutes, 600000 msec // To keep the startup fast.. m_qtimer->start(600000); @@ -42,23 +42,21 @@ KPackageKit::KPackageKit(QObject *parent, const QList&) KPackageKit::~KPackageKit() { - delete m_qtimer; - delete m_confWatch; } void KPackageKit::init() { m_qtimer->stop(); m_qtimer->disconnect(); - connect(m_qtimer, SIGNAL(timeout()), this, SLOT(checkUpdates())); + connect( m_qtimer, SIGNAL( timeout() ), this, SLOT( read() ) ); read(); //check if any changes to the file occour //this also prevents from reading when a checkUpdate happens m_confWatch = new KDirWatch(this); m_confWatch->addFile( KStandardDirs::locateLocal("config", "KPackageKit") ); - connect(m_confWatch, SIGNAL( dirty(const QString &) ), this, SLOT( checkUpdates() )); - connect(m_confWatch, SIGNAL( created(const QString &) ), this, SLOT( checkUpdates() )); - connect(m_confWatch, SIGNAL( deleted(const QString &) ), this, SLOT( checkUpdates() )); + connect( m_confWatch, SIGNAL( dirty(const QString &) ), this, SLOT( read() ) ); + connect( m_confWatch, SIGNAL( created(const QString &) ), this, SLOT( read() ) ); + connect( m_confWatch, SIGNAL( deleted(const QString &) ), this, SLOT( read() ) ); m_confWatch->startScan(); } @@ -66,10 +64,10 @@ void KPackageKit::read() { KConfig config("KPackageKit"); KConfigGroup checkUpdateGroup( &config, "CheckUpdate" ); - if ( checkUpdateGroup.readEntry( "never", false ) ) - return; // default to one day, 86400 sec uint interval = checkUpdateGroup.readEntry( "interval", 86400 ); + if ( interval == 0 ) + return; uint lastCheck = checkUpdateGroup.readEntry( "lastChecked", 0 ); uint now = QDateTime::currentDateTime().toTime_t(); if ( interval + lastCheck < now ) { @@ -96,5 +94,5 @@ void KPackageKit::write() void KPackageKit::checkUpdates() { -// KMessageBox::questionYesNo( 0, tr("Local ") + KStandardDirs::locateLocal("config", "KPackageKit") , "Restart?"); +// KMessageBox::questionYesNo( 0, tr("Local ") + KStandardDirs::locateLocal("config", "KPackageKit") , "Rest?"); } diff --git a/gui/KPackageKitD/kpackagekitd.h b/gui/KPackageKitD/kpackagekitd.h index 879b472..210bb9e 100644 --- a/gui/KPackageKitD/kpackagekitd.h +++ b/gui/KPackageKitD/kpackagekitd.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/Settings/CMakeLists.txt b/gui/Settings/CMakeLists.txt index 13cf891..9762ed0 100644 --- a/gui/Settings/CMakeLists.txt +++ b/gui/Settings/CMakeLists.txt @@ -7,6 +7,6 @@ kde4_add_ui_files(kpk_settings_SRCS ) kde4_add_plugin(kcm_kpk_settings ${kpk_settings_SRCS}) -target_link_libraries(kcm_kpk_settings ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KNEWSTUFF2_LIBS}) +target_link_libraries(kcm_kpk_settings ${KDE4_KDEUI_LIBS}) install(TARGETS kcm_kpk_settings DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/gui/Settings/PkConfigSkell.cpp b/gui/Settings/PkConfigSkell.cpp index 2aa1b63..f457f01 100644 --- a/gui/Settings/PkConfigSkell.cpp +++ b/gui/Settings/PkConfigSkell.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/Settings/PkConfigSkell.h b/gui/Settings/PkConfigSkell.h index 43ec54f..20f4bc3 100644 --- a/gui/Settings/PkConfigSkell.h +++ b/gui/Settings/PkConfigSkell.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/Settings/PkSettings.cpp b/gui/Settings/PkSettings.cpp index 100e852..12cbd0e 100755 --- a/gui/Settings/PkSettings.cpp +++ b/gui/Settings/PkSettings.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/Settings/PkSettings.h b/gui/Settings/PkSettings.h index 4d90ecc..685cd8d 100755 --- a/gui/Settings/PkSettings.h +++ b/gui/Settings/PkSettings.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/Settings/kpk-settings.cpp b/gui/Settings/kpk-settings.cpp index f678e64..0ef6472 100644 --- a/gui/Settings/kpk-settings.cpp +++ b/gui/Settings/kpk-settings.cpp @@ -1,5 +1,5 @@ /* This file is part of the KDE project - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 diff --git a/gui/Settings/kpk-settings.h b/gui/Settings/kpk-settings.h index 5703254..179a968 100644 --- a/gui/Settings/kpk-settings.h +++ b/gui/Settings/kpk-settings.h @@ -1,5 +1,5 @@ /* This file is part of the KDE project - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 diff --git a/gui/Updater/CMakeLists.txt b/gui/Updater/CMakeLists.txt index 47a05c4..9545a9a 100644 --- a/gui/Updater/CMakeLists.txt +++ b/gui/Updater/CMakeLists.txt @@ -4,12 +4,15 @@ set(kpk_update_SRCS PkAddRm_Model.cpp PkAddRm_Delegate.cpp pkg_item.cpp + ../Common/PkTransaction.cpp + ../Common/PkStrings.cpp ) kde4_add_ui_files(kpk_update_SRCS PkUpdate.ui + ../Common/PkTransaction.ui ) kde4_add_plugin(kcm_kpk_update ${kpk_update_SRCS}) -target_link_libraries(kcm_kpk_update ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KNEWSTUFF2_LIBS} packagekit-qt) +target_link_libraries(kcm_kpk_update ${KDE4_KDEUI_LIBS} ${QPACKAGEKIT_LIB}) -install(TARGETS kcm_kpk_update DESTINATION ${PLUGIN_INSTALL_DIR} ) \ No newline at end of file +install(TARGETS kcm_kpk_update DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/gui/Updater/PkAddRm_Delegate.cpp b/gui/Updater/PkAddRm_Delegate.cpp index b6ec7f9..7553786 100644 --- a/gui/Updater/PkAddRm_Delegate.cpp +++ b/gui/Updater/PkAddRm_Delegate.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2007 Ivan Cukic - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library/Lesser General Public License diff --git a/gui/Updater/PkAddRm_Delegate.h b/gui/Updater/PkAddRm_Delegate.h index 4d2b84a..cd3b3c1 100644 --- a/gui/Updater/PkAddRm_Delegate.h +++ b/gui/Updater/PkAddRm_Delegate.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2007 Ivan Cukic - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library/Lesser General Public License diff --git a/gui/Updater/PkUpdate.cpp b/gui/Updater/PkUpdate.cpp index 274b8ce..a30bbfb 100755 --- a/gui/Updater/PkUpdate.cpp +++ b/gui/Updater/PkUpdate.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * @@ -19,6 +19,9 @@ ***************************************************************************/ #include "PkUpdate.h" +#include "../Common/PkTransaction.h" + +#include PkUpdate::PkUpdate( QWidget *parent ) : QWidget( parent ) { @@ -49,6 +52,15 @@ void PkUpdate::on_updatePB_clicked() void PkUpdate::on_refreshPB_clicked() { qDebug() << "refresh"; + Transaction *m_trans = m_daemon->newTransaction(); + /* if (*/ m_trans->refreshCache(true);/* ) {*/ + PkTransaction *frm = new PkTransaction(m_trans, i18n("Refresh Cache"), this); + connect( frm, SIGNAL( Finished(bool) ), this, SLOT( remFinished(bool) ) ); + frm->show(); +// } +// else +// KMessageBox::error( this, i18n("Authentication failed"), i18n("KPackageKit") ); + } void PkUpdate::on_historyPB_clicked() diff --git a/gui/Updater/PkUpdate.h b/gui/Updater/PkUpdate.h index c001443..9aa744d 100755 --- a/gui/Updater/PkUpdate.h +++ b/gui/Updater/PkUpdate.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Daniel Nicoletti * - * mirttex85-pk@yahoo.com.br * + * 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 * diff --git a/gui/Updater/kpk-update.cpp b/gui/Updater/kpk-update.cpp index 2fc3726..c377339 100644 --- a/gui/Updater/kpk-update.cpp +++ b/gui/Updater/kpk-update.cpp @@ -1,5 +1,5 @@ /* This file is part of the KDE project - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 diff --git a/gui/Updater/kpk-update.h b/gui/Updater/kpk-update.h index b1ab064..8b8122b 100644 --- a/gui/Updater/kpk-update.h +++ b/gui/Updater/kpk-update.h @@ -1,5 +1,5 @@ /* This file is part of the KDE project - * Copyright (C) 2008 Daniel Nicoletti + * Copyright (C) 2008 Daniel Nicoletti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 diff --git a/lib/PolkitClient.cpp b/lib/PolkitClient.cpp index 480ec0a..6d3b85c 100644 --- a/lib/PolkitClient.cpp +++ b/lib/PolkitClient.cpp @@ -1,3 +1,4 @@ +#include #include #include "PolkitClient.h" @@ -9,12 +10,36 @@ PolkitClient::PolkitClient(QObject *parent) : QObject(parent) { } bool PolkitClient::getAuth(const QString &action) { - DBusError e; - dbus_error_init(&e); - bool auth = polkit_auth_obtain(action.toAscii().data(), 0, QCoreApplication::applicationPid(), &e); - if(!auth) { - qDebug() << "Authentification error :" << e.name << ":" << e.message; +// DBusError e; +// dbus_error_init(&e); + +// PolKitAction *p_action = polkit_action_new(); + PolKitAction *p_action = polkit_action_new_from_string_representation("org.freedesktop.packagekit.refresh-cache"); + +// if ( !polkit_action_set_action_id( p_action, "org.freedesktop.packagekit.refresh-cache" ) ) { +// qDebug() << "polkit action false"; +// } + qDebug() << "validade" << polkit_action_validate_id("org.freedesktop.packagekit.refresh-cache"); + qDebug() << "check_auth" << polkit_check_auth( QCoreApplication::applicationPid(), "org.freedesktop.packagekit.refresh-cache" ); +// return true; +// bool auth = polkit_auth_obtain(action.toAscii().data(), 0, QCoreApplication::applicationPid(), &e); +// if(!auth) { +// qDebug() << "Authentification error :" << e.name << ":" << e.message; +// } + + PolKitGrant *p_auth = polkit_grant_new(); + + + + PolKitCaller *p_caller = polkit_caller_new(); + + if ( !polkit_caller_set_pid( p_caller, QCoreApplication::applicationPid() ) ){ + qDebug() << "polkit caller false"; } - return auth; + +// polkit_grant_set_functions(p_auth); + return polkit_grant_initiate_auth(p_auth, p_action, p_caller); + +// return auth; } diff --git a/lib/Transaction.cpp b/lib/Transaction.cpp index 1d39793..3709df5 100644 --- a/lib/Transaction.cpp +++ b/lib/Transaction.cpp @@ -249,12 +249,12 @@ void Transaction::getUpdateDetail(const QString& package_id) { bool Transaction::refreshCache(bool force) { qDebug() << "Trying to get authorization..."; - if (polkit->getAuth(AUTH_REFRESHCACHE)) { +// if (polkit->getAuth(AUTH_REFRESHCACHE)) { renewTid(); proxy->RefreshCache(force); - } - else - return false; +// } +// else +// return false; return true; } -- cgit v1.2.3