[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasmate/plasmate/frameworks] plasmate: Implement ProjectHandler::removeProjectFromDisk
From:       Antonis Tsiapaliokas <kok3rs () gmail ! com>
Date:       2014-01-16 16:08:31
Message-ID: E1W3pUd-0005Ye-R7 () scm ! kde ! org
[Download RAW message or body]

Git commit bdc6c13bcbda6e4a13e99a5e9ad25f01fac93dc2 by Antonis Tsiapaliokas.
Committed on 16/01/2014 at 16:04.
Pushed by tsiapaliokas into branch 'plasmate/frameworks'.

Implement ProjectHandler::removeProjectFromDisk

the removeProjectFromDisk method removes the desired project
from our hard disk.

M  +6    -0    plasmate/projecthandler.cpp
M  +1    -0    plasmate/projecthandler.h
M  +5    -1    plasmate/tests/projecthandlertest.cpp

http://commits.kde.org/plasmate/bdc6c13bcbda6e4a13e99a5e9ad25f01fac93dc2

diff --git a/plasmate/projecthandler.cpp b/plasmate/projecthandler.cpp
index db170a1..35e836b 100644
--- a/plasmate/projecthandler.cpp
+++ b/plasmate/projecthandler.cpp
@@ -125,3 +125,9 @@ void ProjectHandler::removeProject(const QString &projectPath)
     loadProjectsList();
 }
 
+bool ProjectHandler::removeProjectFromDisk(const QString &projectPath)
+{
+    QDir projectDir(projectPath);
+    removeProject(projectPath);
+    return projectDir.removeRecursively();
+}
diff --git a/plasmate/projecthandler.h b/plasmate/projecthandler.h
index e3969ef..541f9c8 100644
--- a/plasmate/projecthandler.h
+++ b/plasmate/projecthandler.h
@@ -38,6 +38,7 @@ public:
     const QStringList &loadProjectsList();
     void addProject(const QString &projectPath);
     void removeProject(const QString &projectPath);
+    bool removeProjectFromDisk(const QString &projectPath);
     PackageHandler *packageHandler();
 private:
     QStringList m_projectsList;
diff --git a/plasmate/tests/projecthandlertest.cpp b/plasmate/tests/projecthandlertest.cpp
index 0528d29..1100767 100644
--- a/plasmate/tests/projecthandlertest.cpp
+++ b/plasmate/tests/projecthandlertest.cpp
@@ -97,10 +97,14 @@ void ProjectHandlerTest::projectsList()
     Q_ASSERT(list.contains(newTestPackage));
 
     m_projectHandler.removeProject(QDir::tempPath() + "/externaltestpackage");
+    const QDir newTestPackageDir(newTestPackage);
+    m_projectHandler.removeProjectFromDisk(newTestPackage);
+
     list = m_projectHandler.loadProjectsList();
     Q_ASSERT(list.length() > 0);
-    Q_ASSERT(list.count() == 2);
+    Q_ASSERT(list.count() == 1);
     Q_ASSERT(list.contains(testPackagePath));
+    Q_ASSERT(!newTestPackageDir.exists());
 }
 
 QTEST_GUILESS_MAIN(ProjectHandlerTest)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic