summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r--rbutil/rbutilqt/base/uninstall.cpp34
-rw-r--r--rbutil/rbutilqt/base/uninstall.h10
2 files changed, 21 insertions, 23 deletions
diff --git a/rbutil/rbutilqt/base/uninstall.cpp b/rbutil/rbutilqt/base/uninstall.cpp
index 2f3b3c767f..14674837d9 100644
--- a/rbutil/rbutilqt/base/uninstall.cpp
+++ b/rbutil/rbutilqt/base/uninstall.cpp
@@ -26,30 +26,27 @@ Uninstaller::Uninstaller(QObject* parent,QString mountpoint): QObject(parent)
26 m_mountpoint = mountpoint; 26 m_mountpoint = mountpoint;
27} 27}
28 28
29void Uninstaller::deleteAll(ProgressloggerInterface* dp) 29void Uninstaller::deleteAll(void)
30{ 30{
31 m_dp = dp;
32 QString rbdir(m_mountpoint + ".rockbox/"); 31 QString rbdir(m_mountpoint + ".rockbox/");
33 m_dp->addItem(tr("Starting Uninstallation"),LOGINFO); 32 emit logItem(tr("Starting Uninstallation"), LOGINFO);
34 m_dp->setProgressMax(0); 33 emit logProgress(0, 0);
35 Utils::recursiveRmdir(rbdir); 34 Utils::recursiveRmdir(rbdir);
36 m_dp->setProgressMax(1); 35 emit logProgress(1, 1);
37 m_dp->setProgressValue(1); 36 emit logItem(tr("Finished Uninstallation"), LOGOK);
38 m_dp->addItem(tr("Finished Uninstallation"),LOGOK); 37 emit logFinished();
39 m_dp->setFinished();
40} 38}
41 39
42void Uninstaller::uninstall(ProgressloggerInterface* dp) 40void Uninstaller::uninstall(void)
43{ 41{
44 m_dp = dp; 42 emit logProgress(0, 0);
45 m_dp->setProgressMax(0); 43 emit logItem(tr("Starting Uninstallation"), LOGINFO);
46 m_dp->addItem(tr("Starting Uninstallation"),LOGINFO);
47 44
48 QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, this); 45 QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, this);
49 46
50 for(int i=0; i< uninstallSections.size() ; i++) 47 for(int i=0; i< uninstallSections.size() ; i++)
51 { 48 {
52 m_dp->addItem(tr("Uninstalling %1...").arg(uninstallSections.at(i)), LOGINFO); 49 emit logItem(tr("Uninstalling %1...").arg(uninstallSections.at(i)), LOGINFO);
53 QCoreApplication::processEvents(); 50 QCoreApplication::processEvents();
54 // create list of all other install sections 51 // create list of all other install sections
55 QStringList sections = installlog.childGroups(); 52 QStringList sections = installlog.childGroups();
@@ -80,8 +77,8 @@ void Uninstaller::uninstall(ProgressloggerInterface* dp)
80 if(toDelete.isFile()) // if it is a file remove it 77 if(toDelete.isFile()) // if it is a file remove it
81 { 78 {
82 if(deleteFile && !QFile::remove(toDelete.filePath())) 79 if(deleteFile && !QFile::remove(toDelete.filePath()))
83 m_dp->addItem(tr("Could not delete %1") 80 emit logItem(tr("Could not delete %1")
84 .arg(toDelete.filePath()),LOGWARNING); 81 .arg(toDelete.filePath()), LOGWARNING);
85 installlog.remove(toDeleteList.at(j)); 82 installlog.remove(toDeleteList.at(j));
86 qDebug() << "deleted: " << toDelete.filePath() ; 83 qDebug() << "deleted: " << toDelete.filePath() ;
87 } 84 }
@@ -108,10 +105,9 @@ void Uninstaller::uninstall(ProgressloggerInterface* dp)
108 } 105 }
109 uninstallSections.clear(); 106 uninstallSections.clear();
110 installlog.sync(); 107 installlog.sync();
111 m_dp->setProgressMax(1); 108 emit logProgress(1, 1);
112 m_dp->setProgressValue(1); 109 emit logItem(tr("Uninstallation finished"), LOGOK);
113 m_dp->addItem(tr("Uninstallation finished"),LOGOK); 110 emit logFinished();
114 m_dp->setFinished();
115} 111}
116 112
117QStringList Uninstaller::getAllSections() 113QStringList Uninstaller::getAllSections()
diff --git a/rbutil/rbutilqt/base/uninstall.h b/rbutil/rbutilqt/base/uninstall.h
index 34faf9a4d7..072ec651da 100644
--- a/rbutil/rbutilqt/base/uninstall.h
+++ b/rbutil/rbutilqt/base/uninstall.h
@@ -35,8 +35,8 @@ public:
35 Uninstaller(QObject* parent,QString mountpoint) ; 35 Uninstaller(QObject* parent,QString mountpoint) ;
36 ~Uninstaller(){} 36 ~Uninstaller(){}
37 37
38 void deleteAll(ProgressloggerInterface* dp); 38 void deleteAll(void);
39 void uninstall(ProgressloggerInterface* dp); 39 void uninstall(void);
40 40
41 bool uninstallPossible(); 41 bool uninstallPossible();
42 42
@@ -44,6 +44,10 @@ public:
44 44
45 void setSections(QStringList sections) {uninstallSections = sections;} 45 void setSections(QStringList sections) {uninstallSections = sections;}
46 46
47signals:
48 void logItem(QString, int); //! set logger item
49 void logProgress(int, int); //! set progress bar.
50 void logFinished(void);
47 51
48private slots: 52private slots:
49 53
@@ -52,8 +56,6 @@ private:
52 QString m_mountpoint; 56 QString m_mountpoint;
53 57
54 QStringList uninstallSections; 58 QStringList uninstallSections;
55
56 ProgressloggerInterface* m_dp;
57}; 59};
58 60
59 61