summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien BUSTANY <madcat@mymadcat.com>2008-07-21 09:27:28 +0200
committerAdrien BUSTANY <madcat@mymadcat.com>2008-07-21 09:27:28 +0200
commit55555cab57b816bcb89524a0052a41c58f984fc6 (patch)
tree976f0488fce0948ad4c1dfa24a828773e17ac43b
parent92dbf9f4958bb4ed1c116a51f1c9b51176f47036 (diff)
parentb770c065a7f9e4dcf28f813b0870acd20dded2f1 (diff)
Merge branch 'master' of git+ssh://madcat@git.packagekit.org/srv/git/QPackageKit
Conflicts: lib/modules/CMakeLists.txt
-rw-r--r--AUTHORS2
-rw-r--r--MAINTAINERS2
-rw-r--r--gui/AddRm/CMakeLists.txt8
-rwxr-xr-xgui/AddRm/PkAddRm.cpp3
-rwxr-xr-xgui/AddRm/PkAddRm.h2
-rw-r--r--gui/AddRm/PkAddRm.ui38
-rwxr-xr-xgui/AddRm/PkRequirements.cpp2
-rwxr-xr-xgui/AddRm/PkRequirements.h2
-rwxr-xr-xgui/AddRm/PkReviewChanges.cpp32
-rwxr-xr-xgui/AddRm/PkReviewChanges.h2
-rw-r--r--gui/AddRm/PkReviewChanges.ui2
-rw-r--r--gui/AddRm/kpk-addrm.cpp2
-rw-r--r--gui/AddRm/kpk-addrm.h2
-rw-r--r--gui/CMakeLists.txt3
-rwxr-xr-xgui/Common/PkStrings.cpp2
-rwxr-xr-xgui/Common/PkStrings.h2
-rwxr-xr-xgui/Common/PkTransaction.cpp (renamed from gui/AddRm/PkTransaction.cpp)4
-rwxr-xr-xgui/Common/PkTransaction.h (renamed from gui/AddRm/PkTransaction.h)2
-rw-r--r--gui/Common/PkTransaction.ui (renamed from gui/AddRm/PkTransaction.ui)0
-rw-r--r--gui/KPackageKitD/CMakeLists.txt4
-rw-r--r--gui/KPackageKitD/kpackagekitd.cpp78
-rw-r--r--gui/KPackageKitD/kpackagekitd.h20
-rw-r--r--gui/Settings/CMakeLists.txt2
-rw-r--r--gui/Settings/PkConfigSkell.cpp28
-rw-r--r--gui/Settings/PkConfigSkell.h33
-rwxr-xr-xgui/Settings/PkSettings.cpp61
-rwxr-xr-xgui/Settings/PkSettings.h16
-rw-r--r--gui/Settings/PkSettings.ui54
-rw-r--r--gui/Settings/kpk-settings.cpp2
-rw-r--r--gui/Settings/kpk-settings.h2
-rw-r--r--gui/Updater/CMakeLists.txt7
-rw-r--r--gui/Updater/PkAddRm_Delegate.cpp2
-rw-r--r--gui/Updater/PkAddRm_Delegate.h2
-rwxr-xr-xgui/Updater/PkUpdate.cpp33
-rwxr-xr-xgui/Updater/PkUpdate.h8
-rw-r--r--gui/Updater/kpk-update.cpp2
-rw-r--r--gui/Updater/kpk-update.h2
-rw-r--r--lib/CMakeLists.txt30
-rw-r--r--lib/Daemon.cpp21
-rw-r--r--lib/Daemon.h4
-rw-r--r--lib/Package.cpp1
-rw-r--r--lib/PolkitClient.cpp17
-rw-r--r--lib/SignatureType.h9
-rw-r--r--lib/Transaction.cpp229
-rw-r--r--lib/Transaction.h30
-rw-r--r--lib/modules/CMakeLists.txt1
46 files changed, 479 insertions, 331 deletions
diff --git a/AUTHORS b/AUTHORS
index 725eaa2..fff4831 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,2 +1,2 @@
Adrien BUSTANY <madcat@mymadcat.com>
-Daniel Nicoletti <mirttex85-pk@yahoo.com.br>
+Daniel Nicoletti <dantti85-pk@yahoo.com.br>
diff --git a/MAINTAINERS b/MAINTAINERS
index caa529b..e68388a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1,2 +1,2 @@
Adrien BUSTANY <madcat@mymadcat.com>
-Daniel Nicoletti <mirttex85-pk@yahoo.com.br> \ No newline at end of file
+Daniel Nicoletti <dantti85-pk@yahoo.com.br> \ 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 9a40e60..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 *
@@ -115,6 +115,7 @@ PkAddRm::PkAddRm( QWidget *parent )
// set fucus on the search lineEdit
lineEdit->setFocus(Qt::OtherFocusReason);
+ findPB->setDefault(true);
findPB->setIcon(m_findIcon);
infoHide();
}
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/PkAddRm.ui b/gui/AddRm/PkAddRm.ui
index 2d69642..63d6010 100644
--- a/gui/AddRm/PkAddRm.ui
+++ b/gui/AddRm/PkAddRm.ui
@@ -50,7 +50,7 @@
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="arrowType" >
- <enum>Qt::DownArrow</enum>
+ <enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
@@ -125,10 +125,10 @@
<widget class="QWidget" name="dockWidgetContents" >
<property name="geometry" >
<rect>
- <x>2</x>
+ <x>4</x>
<y>22</y>
- <width>537</width>
- <height>189</height>
+ <width>533</width>
+ <height>187</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
@@ -150,7 +150,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex" >
- <number>0</number>
+ <number>3</number>
</property>
<property name="elideMode" >
<enum>Qt::ElideNone</enum>
@@ -160,8 +160,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>517</width>
- <height>141</height>
+ <width>513</width>
+ <height>142</height>
</rect>
</property>
<attribute name="title" >
@@ -182,8 +182,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>517</width>
- <height>141</height>
+ <width>513</width>
+ <height>142</height>
</rect>
</property>
<attribute name="title" >
@@ -207,8 +207,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>517</width>
- <height>141</height>
+ <width>513</width>
+ <height>142</height>
</rect>
</property>
<attribute name="title" >
@@ -235,8 +235,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>517</width>
- <height>141</height>
+ <width>513</width>
+ <height>142</height>
</rect>
</property>
<attribute name="title" >
@@ -334,6 +334,18 @@
<header>ktextbrowser.h</header>
</customwidget>
</customwidgets>
+ <tabstops>
+ <tabstop>lineEdit</tabstop>
+ <tabstop>findPB</tabstop>
+ <tabstop>filtersTB</tabstop>
+ <tabstop>groupsCB</tabstop>
+ <tabstop>packageView</tabstop>
+ <tabstop>tabWidget</tabstop>
+ <tabstop>descriptionKTB</tabstop>
+ <tabstop>filesPTE</tabstop>
+ <tabstop>dependsOnLV</tabstop>
+ <tabstop>requiredByLV</tabstop>
+ </tabstops>
<resources/>
<connections/>
</ui>
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 eeedb83..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 <KDebug>
#include "PkRequirements.h"
-#include "PkTransaction.h"
+#include "../Common/PkTransaction.h"
#include "PkReviewChanges.h"
#define UNIVERSAL_PADDING 6
@@ -105,6 +105,9 @@ void PkReviewChanges::checkTask()
m_waitPD->show();
m_transactionReq->getRequires("installed", m_reqDepPackages.takeFirst(), true);
}
+ else {
+ removePackages();
+ }
}
else
KMessageBox::error( this, i18n("Sorry, your backend does not support removing packages"), i18n("Erro KPackageKit") );
@@ -129,6 +132,9 @@ void PkReviewChanges::checkTask()
m_waitPD->show();
m_transactionDep->getDepends("~installed", m_reqDepPackages.takeFirst(), true);
}
+ else {
+ installPackages();
+ }
}
else
KMessageBox::error( this, i18n("Sorry, your backend does not support installing packages"), i18n("Erro KPackageKit") );
@@ -175,10 +181,13 @@ void PkReviewChanges::removePackages()
{
qDebug() << "removePackages";
m_trans = m_daemon->newTransaction();
- 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();
+ 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) ) );
+ frm->show();
+ }
+ else
+ KMessageBox::error( this, i18n("Authentication failed"), i18n("KPackageKit") );
qDebug() << "finished remove";
}
@@ -217,10 +226,13 @@ void PkReviewChanges::installPackages()
{
qDebug() << "installPackages";
m_trans = m_daemon->newTransaction();
- PkTransaction *frm = new PkTransaction(m_trans, QString(i18n("Install Packages")), this);
- connect( frm, SIGNAL( Finished(bool) ), this, SLOT( addFinished(bool) ) );
- m_trans->installPackages(m_addPackages);
- frm->show();
+ if ( m_trans->installPackages(m_addPackages) ) {
+ PkTransaction *frm = new PkTransaction(m_trans, QString(i18n("Install Packages")), this);
+ connect( frm, SIGNAL( Finished(bool) ), this, SLOT( addFinished(bool) ) );
+ frm->show();
+ }
+ else
+ KMessageBox::error( this, i18n("Authentication failed"), i18n("KPackageKit") );
qDebug() << "finished install";
}
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/PkReviewChanges.ui b/gui/AddRm/PkReviewChanges.ui
index f992070..9cdc570 100644
--- a/gui/AddRm/PkReviewChanges.ui
+++ b/gui/AddRm/PkReviewChanges.ui
@@ -23,7 +23,7 @@
</font>
</property>
<property name="text" >
- <string>You selected the folowwing packages to be INSTALLED/REMOVED, press ok to proced:</string>
+ <string>You selected the folowing packages to be INSTALLED/REMOVED, press ok to proced:</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
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 <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 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 <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 version 2
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index 9a41985..d1e9d8d 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/AddRm/PkTransaction.cpp b/gui/Common/PkTransaction.cpp
index 173f4ef..2892479 100755
--- a/gui/AddRm/PkTransaction.cpp
+++ b/gui/Common/PkTransaction.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 *
@@ -33,7 +33,7 @@ PkTransaction::PkTransaction( Transaction *trans, QString caption, QWidget *pare
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(const QString&, const QString&) ), this, SLOT( ErrorCode(const QString&, const QString&) ) );
+ 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) ) );
diff --git a/gui/AddRm/PkTransaction.h b/gui/Common/PkTransaction.h
index 27982ad..6d39f55 100755
--- a/gui/AddRm/PkTransaction.h
+++ b/gui/Common/PkTransaction.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.ui b/gui/Common/PkTransaction.ui
index 399644a..399644a 100644
--- a/gui/AddRm/PkTransaction.ui
+++ b/gui/Common/PkTransaction.ui
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 adc3d22..06d3b04 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,59 +18,73 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-//#include "kpkckagekitd.moc"
-#include <kgenericfactory.h>
+#include "kpackagekitd.h"
+
+#include <KGenericFactory>
#include <KStandardDirs>
#include <KConfigGroup>
#include <QDateTime>
-
-#include <KMessageBox>
#include <limits.h>
-#include "kpackagekitd.h"
-K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin<KPackageKit>(); )
+#define TEN_MIN 600000
+
+K_PLUGIN_FACTORY(KPackageKitFactory, registerPlugin<KPackageKitD>(); )
K_EXPORT_PLUGIN(KPackageKitFactory("kpackagekitd"))
-KPackageKit::KPackageKit(QObject *parent, const QList<QVariant>&)
+KPackageKitD::KPackageKitD(QObject *parent, const QList<QVariant>&)
: 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(1000);
+ m_qtimer->start(TEN_MIN);
}
-KPackageKit::~KPackageKit()
+KPackageKitD::~KPackageKitD()
{
- delete m_qtimer;
- delete m_confWatch;
}
-void KPackageKit::init()
+void KPackageKitD::init()
{
m_qtimer->stop();
m_qtimer->disconnect();
- connect(m_qtimer, SIGNAL(timeout()), this, SLOT(checkUpdates()));
+ connect( m_qtimer, SIGNAL( timeout() ), this, SLOT( read() ) );
+
+ // Create a new daemon
+ m_daemon = new Daemon(this);
+
+ uint actions = m_daemon->getActions();
+
+ if ( !(actions & Actions::Refresh_cache) ) {
+ //if the backend does not suport refreshing cache let's don't do nothing
+ return;
+ }
+
+ m_pkClient_updates = m_daemon->newTransaction();
+// connect( m_pkClient_updates, SIGNAL(GotPackage(Package *)), m_pkg_model_updates, SLOT(addPackage(Package *)) );
+ connect( m_pkClient_updates, SIGNAL( Finished(Exit::Value, uint)), this, SLOT( Finished(Exit::Value, uint) ) );
+
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();
}
-void KPackageKit::read()
+void KPackageKitD::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 ) {
@@ -81,21 +95,33 @@ void KPackageKit::read()
//interval - (now - lastCheck)
//Schedule for msecs...
//check first to see any overflow...
- if ( (now - lastCheck - interval) > 4294966 )
+ if ( (interval + lastCheck - now) > 4294966 )
m_qtimer->start( UINT_MAX );
else
- m_qtimer->start( (now - lastCheck - interval) * 1000 );
+ m_qtimer->start( (interval + lastCheck - now) * 1000 );
}
}
-void KPackageKit::write()
+void KPackageKitD::write()
{
KConfig config("KPackageKit");
KConfigGroup checkUpdateGroup( &config, "CheckUpdate" );
checkUpdateGroup.writeEntry( "lastChecked", QDateTime::currentDateTime().toTime_t() );
}
-void KPackageKit::checkUpdates()
+void KPackageKitD::Finished(Exit::Value status, uint)
+{
+ if ( status == Exit::Success )
+ write();
+ else
+ // try again in 10 minutes
+ m_qtimer->start(TEN_MIN);
+}
+
+
+void KPackageKitD::checkUpdates()
{
- KMessageBox::questionYesNo( 0, tr("Local ") + KStandardDirs::locateLocal("config", "KPackageKit") , "Restart?");
+ if ( !m_pkClient_updates->refreshCache(true) )
+ // try again in 10 minutes
+ m_qtimer->start(TEN_MIN);
}
diff --git a/gui/KPackageKitD/kpackagekitd.h b/gui/KPackageKitD/kpackagekitd.h
index 879b472..7f9cf58 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 *
@@ -18,28 +18,36 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#ifndef KPACKAGEKIT_H
-#define KPACKAGEKIT_H
+#ifndef KPACKAGEKITD_H
+#define KPACKAGEKITD_H
#include <KDEDModule>
#include <KDirWatch>
#include <QTimer>
+#include <QPackageKit>
-class KPackageKit : public KDEDModule
+using namespace PackageKit;
+
+class KPackageKitD : public KDEDModule
{
Q_OBJECT
public:
- KPackageKit(QObject *parent, const QList<QVariant>&);
- ~KPackageKit();
+ KPackageKitD(QObject *parent, const QList<QVariant>&);
+ ~KPackageKitD();
+
private:
QTimer *m_qtimer;
KDirWatch *m_confWatch;
+ Daemon *m_daemon;
+ Transaction *m_pkClient_updates;
+
private slots:
void init();
void read();
void write();
void checkUpdates();
+ void Finished(Exit::Value, uint);
};
#endif
diff --git a/gui/Settings/CMakeLists.txt b/gui/Settings/CMakeLists.txt
index 13cf891..befd9e7 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} ${QPACKAGEKIT_LIB})
install(TARGETS kcm_kpk_settings DESTINATION ${PLUGIN_INSTALL_DIR} )
diff --git a/gui/Settings/PkConfigSkell.cpp b/gui/Settings/PkConfigSkell.cpp
deleted file mode 100644
index 2aa1b63..0000000
--- a/gui/Settings/PkConfigSkell.cpp
+++ /dev/null
@@ -1,28 +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 "PkConfigSkell.h"
-
-PkConfigSkell::PkConfigSkell()
-{
- setCurrentGroup("SmartIcon");
- addItemBool("notify", notify, true);
- addItemBool("longTask", longTask, true);
-}
diff --git a/gui/Settings/PkConfigSkell.h b/gui/Settings/PkConfigSkell.h
deleted file mode 100644
index 43ec54f..0000000
--- a/gui/Settings/PkConfigSkell.h
+++ /dev/null
@@ -1,33 +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 <KConfigSkeleton>
-
-#ifndef PKCONFIGSKELL_H
-#define PKCONFIGSKELL_H
-
-class PkConfigSkell : public KConfigSkeleton
-{
-public:
- PkConfigSkell();
- bool notify, longTask;
-};
-
-#endif
diff --git a/gui/Settings/PkSettings.cpp b/gui/Settings/PkSettings.cpp
index 100e852..d0ed21b 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 *
@@ -21,32 +21,52 @@
#include "PkSettings.h"
#include <KDebug>
#include <KConfig>
-#include <KGlobal>
-
-// 1 Hour = 3600 in Epoch
-// 1 Day = 86400 in Epoch (24 Hours)
-// 1 Week = 604800 in Epoch (7 Days / 168 Hours)
-// 1 Month = 2628000 in Epoch
+#include <KLocale>
+#define HOURLY 3600
+#define DAILY 86400
+#define WEEKLY 604800
+#define MONTHLY 2628000
+#define NEVER 0
PkSettings::PkSettings( QWidget *parent ) : QWidget( parent )
{
setupUi( this );
-// m_kcfDM = new KConfigDialogManager(this, m_pk_cfgSkell = new PkConfigSkell());
- connect( notifyUpdatesCB, SIGNAL(stateChanged(int)), this, SLOT(checkChanges(int)) );
- connect( notifyLongTasksCB, SIGNAL(stateChanged(int)), this, SLOT(checkChanges(int)) );
+
+ // Create a new daemon
+ m_daemon = new Daemon(this);
+
+ uint actions = m_daemon->getActions();
+
+ if ( !(actions & Actions::Refresh_cache) ) {
+ intervalL->setEnabled(false);
+ intervalCB->setEnabled(false);
+ }
+
+ intervalCB->addItem(i18n("Hourly"), HOURLY );
+ intervalCB->addItem(i18n("Daily"), DAILY );
+ intervalCB->addItem(i18n("Weekly"), WEEKLY );
+ intervalCB->addItem(i18n("Monthly"), MONTHLY );
+ intervalCB->addItem(i18n("Never"), NEVER );
+
+ connect( notifyUpdatesCB, SIGNAL( stateChanged(int) ), this, SLOT( checkChanges(int) ) );
+ connect( notifyLongTasksCB, SIGNAL( stateChanged(int) ), this, SLOT( checkChanges(int) ) );
+ connect( intervalCB, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkChanges(int) ) );
}
void PkSettings::checkChanges(int)
{
- kDebug() << "checkChanges " << notifyUpdatesCB->checkState();
KConfig config("KPackageKit");
KConfigGroup smartIconGroup( &config, "SmartIcon" );
+ KConfigGroup checkUpdateGroup( &config, "CheckUpdate" );
if ( notifyUpdatesCB->checkState() !=
(Qt::CheckState) smartIconGroup.readEntry( "notifyUpdatesCB", (int) Qt::Checked)
||
notifyLongTasksCB->checkState() !=
- (Qt::CheckState) smartIconGroup.readEntry( "notifyLongTasksCB", (int) Qt::Checked) )
+ (Qt::CheckState) smartIconGroup.readEntry( "notifyLongTasksCB", (int) Qt::Checked)
+ ||
+ intervalCB->itemData( intervalCB->currentIndex() ).toUInt() !=
+ (uint) checkUpdateGroup.readEntry( "interval", DAILY ) )
emit(changed(true));
else
emit(changed(false));
@@ -54,30 +74,39 @@ void PkSettings::checkChanges(int)
void PkSettings::load()
{
- kDebug() << "load";
KConfig config("KPackageKit");
KConfigGroup smartIconGroup( &config, "SmartIcon" );
notifyUpdatesCB->setCheckState( (Qt::CheckState) smartIconGroup.readEntry( "notifyUpdatesCB",
(int) Qt::Checked) );
notifyLongTasksCB->setCheckState( (Qt::CheckState) smartIconGroup.readEntry( "notifyLongTasksCB",
(int) Qt::Checked) );
+ KConfigGroup checkUpdateGroup( &config, "CheckUpdate" );
+ uint interval = checkUpdateGroup.readEntry( "interval", DAILY );
+ 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->setCurrentIndex( intervalCB->count() - 1 );
+ }
+ else
+ intervalCB->setCurrentIndex(ret);
}
void PkSettings::save()
{
- kDebug() << "save";
KConfig config("KPackageKit");
KConfigGroup smartIconGroup( &config, "SmartIcon" );
smartIconGroup.writeEntry( "notifyUpdatesCB", (int) notifyUpdatesCB->checkState() );
smartIconGroup.writeEntry( "notifyLongTasksCB", (int) notifyLongTasksCB->checkState() );
-config.sync();
+ KConfigGroup checkUpdateGroup( &config, "CheckUpdate" );
+ checkUpdateGroup.writeEntry( "interval", intervalCB->itemData( intervalCB->currentIndex() ).toUInt() );
}
void PkSettings::defaults()
{
- kDebug() << "defaults";
notifyUpdatesCB->setCheckState(Qt::Checked);
notifyLongTasksCB->setCheckState(Qt::Checked);
+ intervalCB->setCurrentIndex( intervalCB->findData(DAILY) );
emit(checkChanges(0));
}
diff --git a/gui/Settings/PkSettings.h b/gui/Settings/PkSettings.h
index 4d90ecc..09f534f 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 *
@@ -21,9 +21,12 @@
#ifndef PKSETTINGS_H
#define PKSETTINGS_H
-#include <kconfigdialogmanager.h>
-// #include "PkConfigSkell.h"
+#include <KConfigDialogManager>
+#include <QPackageKit>
+
#include "ui_PkSettings.h"
+
+using namespace PackageKit;
class PkSettings : public QWidget, public Ui::PkSettings
{
@@ -31,17 +34,18 @@ Q_OBJECT
public:
PkSettings( QWidget *parent=0 );
+
public slots:
void load();
void save();
void defaults();
void checkChanges(int state);
+
signals:
void changed(bool state);
-// public:
-// KConfigDialogManager *m_kcfDM;
-// PkConfigSkell *m_pk_cfgSkell;
+private:
+ Daemon *m_daemon;
};
#endif
diff --git a/gui/Settings/PkSettings.ui b/gui/Settings/PkSettings.ui
index c6f49a5..96391ed 100644
--- a/gui/Settings/PkSettings.ui
+++ b/gui/Settings/PkSettings.ui
@@ -26,53 +26,34 @@
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
- <widget class="QLabel" name="label_2" >
+ <widget class="QLabel" name="intervalL" >
<property name="text" >
<string>Check for Updates:</string>
</property>
</widget>
</item>
- <item row="0" column="2" >
- <widget class="QComboBox" name="comboBox" >
+ <item row="0" column="1" colspan="2" >
+ <widget class="QComboBox" name="intervalCB" >
<property name="currentIndex" >
- <number>1</number>
+ <number>-1</number>
</property>
- <item>
- <property name="text" >
- <string>Hourly</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Daily</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Weekly</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Monthly</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Never</string>
- </property>
- </item>
</widget>
</item>
- <item row="1" column="0" colspan="2" >
+ <item row="1" column="0" >
<widget class="QLabel" name="label_3" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="text" >
<string>Automatically Install:</string>
</property>
</widget>
</item>
- <item row="1" column="2" >
- <widget class="QComboBox" name="comboBox_2" >
+ <item row="1" column="1" colspan="2" >
+ <widget class="QComboBox" name="autoCB" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<item>
<property name="text" >
<string>Security Only</string>
@@ -101,6 +82,9 @@
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="QCheckBox" name="notifyUpdatesCB" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="text" >
<string>Notify when updates are avaliable</string>
</property>
@@ -114,6 +98,9 @@
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="notifyLongTasksCB" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="text" >
<string>Notify when long tasks have been completed</string>
</property>
@@ -127,6 +114,9 @@
</item>
<item row="2" column="0" >
<widget class="KEditListBox" name="keditlistbox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="title" >
<string>Packages Sources</string>
</property>
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 <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 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 <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 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 <ivan.cukic+kde@gmail.com>
- * Copyright (C) 2008 Daniel Nicoletti <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 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 <ivan.cukic+kde@gmail.com>
- * Copyright (C) 2008 Daniel Nicoletti <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 Library/Lesser General Public License
diff --git a/gui/Updater/PkUpdate.cpp b/gui/Updater/PkUpdate.cpp
index 274b8ce..16b56a2 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 <KMessageBox>
PkUpdate::PkUpdate( QWidget *parent ) : QWidget( parent )
{
@@ -33,11 +36,11 @@ PkUpdate::PkUpdate( QWidget *parent ) : QWidget( parent )
m_daemon = new Daemon(this);
m_pkClient_updates = m_daemon->newTransaction();
- connect( m_pkClient_updates, SIGNAL(GotPackage(Package *)), m_pkg_model_updates, SLOT(addPackage(Package *)) );
- connect( m_pkClient_updates, SIGNAL(Finished(Exit::Value, uint)), this, SLOT(Finished(Exit::Value, uint)) );
- connect( m_pkClient_updates, SIGNAL(Files(Package *, QStringList)), this, SLOT(Files(Package *, QStringList)) );
- connect( m_pkClient_updates, SIGNAL( Message(const QString&, const QString&) ), this, SLOT( Message(const QString&, const QString&) ) );
- connect( m_pkClient_updates, SIGNAL( ErrorCode(const QString&, const QString&) ), this, SLOT( Message(const QString&, const QString&) ) );
+ connect( m_pkClient_updates, SIGNAL( GotPackage(Package *) ), m_pkg_model_updates, SLOT( addPackage(Package *) ) );
+// connect( m_pkClient_updates, SIGNAL(Finished(Exit::Value, uint)), this, SLOT(Finished(Exit::Value, uint)) );
+// connect( m_pkClient_updates, SIGNAL(Files(Package *, QStringList)), this, SLOT(Files(Package *, QStringList)) );
+// connect( m_pkClient_updates, SIGNAL( Message(const QString&, const QString&) ), this, SLOT( Message(const QString&, const QString&) ) );
+// connect( m_pkClient_updates, SIGNAL( ErrorCode(const QString&, const QString&) ), this, SLOT( Message(const QString&, const QString&) ) );
m_pkClient_updates->getUpdates("none");
}
@@ -48,7 +51,23 @@ 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( refreshCacheFinished(bool) ) );
+ frm->show();
+ }
+ else
+ KMessageBox::error( this, i18n("Authentication failed"), i18n("KPackageKit") );
+}
+
+void PkUpdate::refreshCacheFinished(bool error)
+{
+ if (!error) {
+ KConfig config("KPackageKit");
+ KConfigGroup checkUpdateGroup( &config, "CheckUpdate" );
+ checkUpdateGroup.writeEntry( "lastChecked", QDateTime::currentDateTime().toTime_t() );
+ }
}
void PkUpdate::on_historyPB_clicked()
diff --git a/gui/Updater/PkUpdate.h b/gui/Updater/PkUpdate.h
index c001443..1f772b0 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 *
@@ -21,10 +21,11 @@
#ifndef PKUPDATE_H
#define PKUPDATE_H
+#include <QPackageKit>
+
#include "PkAddRm_Model.h"
#include "PkAddRm_Delegate.h"
#include "ui_PkUpdate.h"
-#include <QPackageKit>
using namespace PackageKit;
@@ -33,10 +34,13 @@ class PkUpdate : public QWidget, public Ui::PkUpdate
Q_OBJECT
public:
PkUpdate( QWidget *parent=0 );
+
private slots:
void on_updatePB_clicked();
void on_refreshPB_clicked();
void on_historyPB_clicked();
+ void refreshCacheFinished(bool error);
+
private:
PkAddRmModel *m_pkg_model_updates;
PkAddRmDelegate *pkg_delegate;
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 <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 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 <mirttex85-pk@yahoo.com.br>
+ * Copyright (C) 2008 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 version 2
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 625d122..59acc59 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -12,14 +12,14 @@ find_package(Qt4 REQUIRED)
add_definitions(${QT_DEFINITIONS})
include(FindPkgConfig)
-pkg_check_modules(POLICYKIT polkit-dbus)
+pkg_check_modules(POLKIT polkit-dbus)
include_directories(
${QT_INCLUDES}
- ${POLICYKIT_INCLUDE_DIRS}
+ ${POLKIT_INCLUDE_DIRS}
)
-set( packagekit-qt_LIB_SRCS
+set( PK_LIB_SRCS
CentralProxy.cpp
Daemon.cpp
Package.cpp
@@ -28,11 +28,32 @@ set( packagekit-qt_LIB_SRCS
TransactionProxy.cpp
)
-add_library(packagekit-qt SHARED ${packagekit-qt_LIB_SRCS})
+set( PK_SRCS
+ CentralProxy.h
+ Daemon.h
+ Package.h
+ PolkitClient.h
+ Transaction.h
+ TransactionProxy.h
+ Error.h
+ Exit.h
+ Actions.h
+ Provides.h
+ Restart.h
+ Role.h
+ SignatureType.h
+ Status.h
+ Groups.h
+)
+
+QT4_WRAP_CPP( Pk_MOC_SRCS ${PK_SRCS} )
+
+add_library(packagekit-qt SHARED ${Pk_MOC_SRCS} ${PK_LIB_SRCS})
set_target_properties( packagekit-qt PROPERTIES VERSION 0.1 SOVERSION 0 )
target_link_libraries(packagekit-qt
${QT_QTCORE_LIBRARY}
+ polkit-dbus
)
install(TARGETS
@@ -50,7 +71,6 @@ install(FILES
Exit.h
Actions.h
Error.h
- Exit.h
Enum.h
Provides.h
Restart.h
diff --git a/lib/Daemon.cpp b/lib/Daemon.cpp
index f0a5a03..e9c7f22 100644
--- a/lib/Daemon.cpp
+++ b/lib/Daemon.cpp
@@ -66,11 +66,17 @@ bool Daemon::getNetworkState() {
return (state == "online");
}
-void Daemon::setProxy(const QString &http_proxy, const QString &ftp_proxy) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_SETPROXY)) emit AuthRefused("Cannot get authorization to set proxy");;
- qDebug() << "We're authentificated";
- proxy->SetProxy(http_proxy, ftp_proxy);
+bool Daemon::setProxy(const QString &http_proxy, const QString &ftp_proxy) {
+ // hopefully do the operation first time
+ if ( proxy->SetProxy(http_proxy, ftp_proxy).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_SETPROXY) )
+ return proxy->SetProxy(http_proxy, ftp_proxy).isValid();
+ else
+ return false;
+ }
}
void Daemon::suggestQuit() {
@@ -89,10 +95,7 @@ QString Daemon::getTid() {
return proxy->GetTid();
}
-void Daemon::sendAuthRefused(const QString &message) {
- emit AuthRefused(message);
-}
-
void Daemon::NetworkStateChanged_cb(const QString &status) {
emit NetworkStateChanged((status == "online"));
}
+
diff --git a/lib/Daemon.h b/lib/Daemon.h
index 6a1ad49..30cad70 100644
--- a/lib/Daemon.h
+++ b/lib/Daemon.h
@@ -43,7 +43,7 @@ public:
uint getTimeSinceAction(Role::Value role);
bool getNetworkState();
- void setProxy(const QString &http_proxy, const QString &ftp_proxy);
+ bool setProxy(const QString &http_proxy, const QString &ftp_proxy);
void suggestQuit();
void stateHasChanged(const QString &reason);
@@ -51,7 +51,6 @@ public:
protected:
QString getTid();
- void sendAuthRefused(const QString &message);
private:
CentralProxy *proxy;
@@ -66,7 +65,6 @@ signals:
void TransactionListChanged(const QStringList &tids);
void RepoListChanged();
void RestartSchedule();
- void AuthRefused(const QString &message); // Called when PolicyKit auth fails
};
diff --git a/lib/Package.cpp b/lib/Package.cpp
index 40e41c7..d064e61 100644
--- a/lib/Package.cpp
+++ b/lib/Package.cpp
@@ -63,3 +63,4 @@ const QString& Package::summary() {
bool Package::operator==(const Package &other) const {
return const_cast<Package*>(this)->id() == const_cast<Package&>(other).id();
}
+
diff --git a/lib/PolkitClient.cpp b/lib/PolkitClient.cpp
index 8717f26..f20e694 100644
--- a/lib/PolkitClient.cpp
+++ b/lib/PolkitClient.cpp
@@ -9,11 +9,14 @@ 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;
- }
- return auth;
+ 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;
+ }
+
+ return auth;
}
+
diff --git a/lib/SignatureType.h b/lib/SignatureType.h
index 270d6fe..ff9ca7f 100644
--- a/lib/SignatureType.h
+++ b/lib/SignatureType.h
@@ -24,10 +24,11 @@ class SignatureType : public QObject {
Q_ENUMS(Value)
public:
- enum Value {
- Gpg,
- Unknown
- };
+typedef enum {
+ Gpg,
+ Unknown
+} Value;
+
};
} // End namespace PackageKit
diff --git a/lib/Transaction.cpp b/lib/Transaction.cpp
index 498fba8..75ee2ab 100644
--- a/lib/Transaction.cpp
+++ b/lib/Transaction.cpp
@@ -129,85 +129,136 @@ void Transaction::resolve(const QString &filter, Package *p) {
proxy->Resolve(filter, p->id());
}
-void Transaction::installPackages(const QList<Package*> &packages) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_INSTALL)) parent->sendAuthRefused("Cannot get authorization to install packages");
- qDebug() << "We're authentificated";
+bool Transaction::installPackages(const QList<Package*> &packages) {
renewTid();
QStringList pids;
for(int i = 0 ; i < packages.size() ; ++i) pids << packages.at(i)->id();
- proxy->InstallPackages(pids);
-}
-
-void Transaction::installPackage(Package *p) {
+ // hopefully do the operation first time
+ if ( proxy->InstallPackages(pids).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_INSTALL) )
+ return proxy->InstallPackages(pids).isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::installPackage(Package *p) {
QList<Package*> packages;
packages << p;
- installPackages(packages);
+ return installPackages(packages);
}
-void Transaction::installSignature(const SignatureType::Value &type, const QString &key_id, Package *p) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_INSTALLSIGNATURE)) parent->sendAuthRefused("Cannot get authorization to install signature");
- qDebug() << "We're authentificated";
+bool Transaction::installSignature(const SignatureType::Value &type, const QString &key_id, Package *p) {
renewTid();
- proxy->InstallSignature(EnumToString<SignatureType>(type), key_id, p->id());
-}
-
-void Transaction::updatePackages(const QList<Package*> &packages) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_UPDATEPACKAGE)) parent->sendAuthRefused("Cannot get authorization to update packages");
- qDebug() << "We're authentificated";
+ // hopefully do the operation first time
+ if ( proxy->InstallSignature(EnumToString<SignatureType>(type), key_id, p->id()).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_INSTALLSIGNATURE) )
+ return proxy->InstallSignature(EnumToString<SignatureType>(type), key_id, p->id()).isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::updatePackages(const QList<Package*> &packages) {
renewTid();
QStringList pids;
for(int i = 0 ; i < packages.size() ; ++i) pids << packages.at(i)->id();
- proxy->UpdatePackages(pids);
-}
-
-void Transaction::updatePackage(Package *p) {
+ // hopefully do the operation first time
+ if ( proxy->UpdatePackages(pids).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_UPDATEPACKAGE) )
+ return proxy->UpdatePackages(pids).isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::updatePackage(Package *p) {
renewTid();
QStringList pids;
pids << p->id();
- proxy->UpdatePackages(pids);
-}
-
-void Transaction::installFiles(const QStringList& files, bool trusted) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth((trusted ? AUTH_LOCALINSTALLTRUSTED : AUTH_LOCALINSTALLUNTRUSTED))) parent->sendAuthRefused("Cannot get authorization to install files");
- qDebug() << "We're authentificated";
+ // hopefully do the operation first time
+ if ( proxy->UpdatePackages(pids).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_UPDATEPACKAGE) )
+ return proxy->UpdatePackages(pids).isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::installFiles(const QStringList& files, bool trusted) {
renewTid();
- proxy->InstallFiles(trusted, files);
-}
-
-void Transaction::removePackages(const QList<Package*> &packages, bool allow_deps, bool autoremove) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_REMOVE)) parent->sendAuthRefused("Cannot get authorization to remove packages");
- qDebug() << "We're authentificated";
+ // hopefully do the operation first time
+ if ( proxy->InstallFiles(trusted, files).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth((trusted ? AUTH_LOCALINSTALLTRUSTED : AUTH_LOCALINSTALLUNTRUSTED)) )
+ return proxy->InstallFiles(trusted, files).isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::removePackages(const QList<Package*> &packages, bool allow_deps, bool autoremove) {
renewTid();
QStringList pids;
for(int i = 0 ; i < packages.size() ; ++i) pids << packages.at(i)->id();
- proxy->RemovePackages(pids, allow_deps, autoremove);
-}
-
-void Transaction::removePackage(Package *p, bool allow_deps, bool autoremove) {
+ // hopefully do the operation first time
+ if ( proxy->RemovePackages(pids, allow_deps, autoremove).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_REMOVE) )
+ return proxy->RemovePackages(pids, allow_deps, autoremove).isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::removePackage(Package *p, bool allow_deps, bool autoremove) {
QList<Package*> packages;
packages << p;
- removePackages(packages, allow_deps, autoremove);
+ return removePackages(packages, allow_deps, autoremove);
}
-void Transaction::updateSystem() {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_UPDATESYSTEM)) parent->sendAuthRefused("Cannot get authorization to update system");
- qDebug() << "We're authentificated";
+bool Transaction::updateSystem() {
renewTid();
- proxy->UpdateSystem();
-}
-
-void Transaction::rollback(const QString &tid) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_ROLLBACK)) parent->sendAuthRefused("Cannot get authorization to rollback a transaction");
- qDebug() << "We're authentificated";
+ // hopefully do the operation first time
+ if ( proxy->UpdateSystem().isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_UPDATESYSTEM) )
+ return proxy->UpdateSystem().isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::rollback(const QString &tid) {
renewTid();
- proxy->Rollback(tid);
+ // hopefully do the operation first time
+ if ( proxy->Rollback(tid).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_ROLLBACK) )
+ return proxy->Rollback(tid).isValid();
+ else
+ return false;
+ }
}
void Transaction::getUpdates(const QString& filter) {
@@ -220,12 +271,18 @@ void Transaction::getUpdateDetail(const QString& package_id) {
proxy->GetUpdateDetail(package_id);
}
-void Transaction::refreshCache(bool force) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_REFRESHCACHE)) parent->sendAuthRefused("Cannot get authorization to refresh cache");
- qDebug() << "We're authentificated";
+bool Transaction::refreshCache(bool force) {
renewTid();
- proxy->RefreshCache(force);
+ // hopefully do the operation first time
+ if ( proxy->RefreshCache(force).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_REFRESHCACHE) )
+ return proxy->RefreshCache(force).isValid();
+ else
+ return false;
+ }
}
void Transaction::getProgress(uint &percentage, uint &subpercentage, uint &elapsed, uint &remaining) {
@@ -237,20 +294,32 @@ void Transaction::getRepoList(const QString &filter) {
proxy->GetRepoList(filter);
}
-void Transaction::repoEnable(const QString &repo_id, bool enabled) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_REPOCHANGE)) parent->sendAuthRefused("Cannot get authorization to change a repository");
- qDebug() << "We're authentificated";
+bool Transaction::repoEnable(const QString &repo_id, bool enabled) {
renewTid();
- proxy->RepoEnable(repo_id, enabled);
-}
-
-void Transaction::repoSetData(const QString &repo_id, const QString &parameter, const QString &value) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_REPOCHANGE)) parent->sendAuthRefused("Cannot get authorization to change a repository");
- qDebug() << "We're authentificated";
+ // hopefully do the operation first time
+ if ( proxy->RepoEnable(repo_id, enabled).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_REPOCHANGE) )
+ return proxy->RepoEnable(repo_id, enabled).isValid();
+ else
+ return false;
+ }
+}
+
+bool Transaction::repoSetData(const QString &repo_id, const QString &parameter, const QString &value) {
renewTid();
- proxy->RepoSetData(repo_id, parameter, value);
+ // hopefully do the operation first time
+ if ( proxy->RepoSetData(repo_id, parameter, value).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_REPOCHANGE) )
+ return proxy->RepoSetData(repo_id, parameter, value).isValid();
+ else
+ return false;
+ }
}
bool Transaction::isCallerActive() {
@@ -263,12 +332,18 @@ void Transaction::getOldTransactions(uint number) {
proxy->GetOldTransactions(number);
}
-void Transaction::acceptEula(const QString &id) {
- qDebug() << "Trying to get authorization...";
- if(!polkit->getAuth(AUTH_ACCEPTEULA)) parent->sendAuthRefused("Cannot get authorization to accept an EULA");
- qDebug() << "We're authentificated";
+bool Transaction::acceptEula(const QString &id) {
renewTid();
- proxy->AcceptEula(id);
+ // hopefully do the operation first time
+ if ( proxy->AcceptEula(id).isValid() )
+ return true;
+ else {
+ // ok no lucky...
+ if ( polkit->getAuth(AUTH_ACCEPTEULA) )
+ return proxy->AcceptEula(id).isValid();
+ else
+ return false;
+ }
}
// Signal callbacks
diff --git a/lib/Transaction.h b/lib/Transaction.h
index b6a49b6..6bc0cf7 100644
--- a/lib/Transaction.h
+++ b/lib/Transaction.h
@@ -57,29 +57,29 @@ public:
void whatProvides(const QString &filter, const Provides::Value &type, const QString& search);
void resolve(const QString &filter, Package *p);
- void installPackages(const QList<Package*> &packages);
- void installPackage(Package *p);
- void installSignature(const SignatureType::Value &type, const QString &key_id, Package *p);
- void updatePackages(const QList<Package*> &packages);
- void updatePackage(Package *p);
- void installFiles(const QStringList& files, bool trusted = false);
- void removePackages(const QList<Package*> &packages, bool allow_deps = false, bool autoremove = false);
- void removePackage(Package *p, bool allow_deps = false, bool autoremove = false);
-
- void updateSystem();
- void rollback(const QString &tid);
+ bool installPackages(const QList<Package*> &packages);
+ bool installPackage(Package *p);
+ bool installSignature(const SignatureType::Value &type, const QString &key_id, Package *p);
+ bool updatePackages(const QList<Package*> &packages);
+ bool updatePackage(Package *p);
+ bool installFiles(const QStringList& files, bool trusted = false);
+ bool removePackages(const QList<Package*> &packages, bool allow_deps = false, bool autoremove = false);
+ bool removePackage(Package *p, bool allow_deps = false, bool autoremove = false);
+
+ bool updateSystem();
+ bool rollback(const QString &tid);
void getUpdates(const QString& filter);
void getUpdateDetail(const QString& package_id);
- void refreshCache(bool force = false);
+ bool refreshCache(bool force = false);
void getProgress(uint &percentage, uint &subpercentage, uint &elapsed, uint &remaining);
void getRepoList(const QString &filter);
- void repoEnable(const QString &repo_id, bool enabled);
- void repoSetData(const QString &repo_id, const QString &parameter, const QString &value);
+ bool repoEnable(const QString &repo_id, bool enabled);
+ bool repoSetData(const QString &repo_id, const QString &parameter, const QString &value);
bool isCallerActive();
void getOldTransactions(uint number);
- void acceptEula(const QString &id);
+ bool acceptEula(const QString &id);
signals:
void GotPackage(Package *p);
diff --git a/lib/modules/CMakeLists.txt b/lib/modules/CMakeLists.txt
index 56494f5..11e0944 100644
--- a/lib/modules/CMakeLists.txt
+++ b/lib/modules/CMakeLists.txt
@@ -2,7 +2,6 @@
## install the cmake files
file( GLOB cmakeFiles FindQPackageKit.cmake )
-# FIXME remove safely /usr/share
set(module_install_dir ${CMAKE_ROOT}/Modules )
install( FILES ${cmakeFiles}