[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [libkipi/development/gsoc2014-kipibqm] tests: Pushed to ask doubt about an error
From: Shourya Singh Gupta <shouryasgupta () gmail ! com>
Date: 2014-06-30 18:47:58
Message-ID: E1X1gcQ-0004Db-Ur () scm ! kde ! org
[Download RAW message or body]
Git commit ef8f7ebc1416821c77ba9824750fbba477ecca46 by Shourya Singh Gupta.
Committed on 30/06/2014 at 18:46.
Pushed by shouryasinghgupta into branch 'development/gsoc2014-kipibqm'.
Pushed to ask doubt about an error
M +1 -0 tests/BatchRenamer/CMakeLists.txt
A +98 -0 tests/BatchRenamer/plugin/task.cpp [License: GPL (v2+)]
A +68 -0 tests/BatchRenamer/plugin/task.h [License: GPL (v2+)]
M +16 -0 tests/list.cpp
M +1 -0 tests/list.h
http://commits.kde.org/libkipi/ef8f7ebc1416821c77ba9824750fbba477ecca46
diff --git a/tests/BatchRenamer/CMakeLists.txt b/tests/BatchRenamer/CMakeLists.txt
index cdcd0dd..12418c1 100644
--- a/tests/BatchRenamer/CMakeLists.txt
+++ b/tests/BatchRenamer/CMakeLists.txt
@@ -31,6 +31,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/plugin
SET(kipiplugin_batchrenamer_PART_SRCS
plugin/plugin_batchrenamer.cpp
plugin/list.cpp
+ plugin/task.cpp
plugin/settings.cpp
plugin/testdialog.cpp
plugin/plugin_getwidget.cpp
diff --git a/tests/BatchRenamer/plugin/task.cpp b/tests/BatchRenamer/plugin/task.cpp
new file mode 100644
index 0000000..b852bbb
--- /dev/null
+++ b/tests/BatchRenamer/plugin/task.cpp
@@ -0,0 +1,98 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2009-02-06
+ * Description : Thread actions task.
+ *
+ * Copyright (C) 2009-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2012 by Pankaj Kumar <me at panks dot me>
+ * Copyright (C) 2014 by Shourya Singh Gupta <shouryasgupta at gmail dot com>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+#include "task.moc"
+
+// Qt includes
+
+#include <QFileInfo>
+
+// KDE includes
+
+#include <kde_file.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+#include <threadweaver/ThreadWeaver.h>
+#include <threadweaver/Job.h>
+#include "kio/job.h"
+#include "kio/jobclasses.h"
+#include <kurl.h>
+
+
+namespace KXMLKipiCmd
+{
+
+class Task::Private
+{
+public:
+
+ Private()
+ {
+
+ }
+
+ KUrl::List imgurls;
+ KUrl::List desturls;
+
+};
+
+// -------------------------------------------------------
+
+Task::Task()
+ : Job(0), d(new Private)
+{
+}
+
+Task::~Task()
+{
+ delete d;
+}
+
+void Task::setImgUrls(KUrl::List list)
+{
+ d->imgurls = list;
+}
+
+void Task::setDestUrls(KUrl::List list)
+{
+ d->desturls = list;
+}
+
+void Task::run()
+{
+ int i = 0;
+ KUrl::List::const_iterator it1 = d->imgurls.constBegin();
+ KUrl::List::const_iterator it2 = d->desturls.constBegin();
+
+ while((it1+i)!= d->imgurls.constEnd())
+ {
+ KIO::SimpleJob* job = KIO::rename(*(it1+i), *(it2+i),0);
+ job->start();
+ i++;
+ }
+}
+
+} // namespace KXMLKipiCmd
diff --git a/tests/BatchRenamer/plugin/task.h b/tests/BatchRenamer/plugin/task.h
new file mode 100644
index 0000000..f167a3c
--- /dev/null
+++ b/tests/BatchRenamer/plugin/task.h
@@ -0,0 +1,68 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2009-02-06
+ * Description : Thread actions task.
+ *
+ * Copyright (C) 2009-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2012 by Pankaj Kumar <me at panks dot me>
+ * Copyright (C) 2014 by Shourya Singh Gupta <shouryasgupta at gmail dot com>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+#ifndef TASK_H
+#define TASK_H
+
+// Qt includes
+
+#include <QThread>
+
+// KDE includes
+
+#include <kurl.h>
+#include <threadweaver/Job.h>
+#include <libkdcraw/ractionthreadbase.h>
+
+using namespace ThreadWeaver;
+
+namespace KXMLKipiCmd
+{
+
+class Task : public Job
+{
+ Q_OBJECT
+
+public:
+
+ Task();
+ ~Task();
+
+ void setImgUrls(KUrl::List list);
+ void setDestUrls(KUrl::List list);
+
+protected:
+
+ void run();
+
+private:
+
+ class Private;
+ Private* const d;
+};
+
+} // namespace KXMLKipiCmd
+
+#endif /* TASK_H */
diff --git a/tests/list.cpp b/tests/list.cpp
index 45452aa..e4a1809 100644
--- a/tests/list.cpp
+++ b/tests/list.cpp
@@ -209,5 +209,21 @@ KUrl::List ListView::imageUrls()
return list;
}
+
+KUrl::List ListView::destUrls()
+{
+ KUrl::List list;
+ QTreeWidgetItemIterator it(this);
+
+ while (*it)
+ {
+ ListViewItem* item = dynamic_cast<ListViewItem*>(*it);
+ list.append(item->DestUrl());
+ ++it;
+ }
+
+ return list;
+
+}
}
diff --git a/tests/list.h b/tests/list.h
index a48f976..3d431d5 100644
--- a/tests/list.h
+++ b/tests/list.h
@@ -75,6 +75,7 @@ public:
~ListView();
ListViewItem* findItem(const KUrl& url);
KUrl::List imageUrls();
+ KUrl::List destUrls();
Q_SIGNALS:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic