summaryrefslogtreecommitdiff
path: root/libsowatch
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-08-15 15:48:47 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-08-15 15:48:47 +0200
commitc752ccafd8d826b3c0c9140e89ece09e90b34cb1 (patch)
tree87b99b668163d7ee57f61ffc7a68b2d1e5594521 /libsowatch
parent6ceeb0c4b0e920740a2b65b01f76bb71f9d75db8 (diff)
downloadsowatch-c752ccafd8d826b3c0c9140e89ece09e90b34cb1.tar.gz
sowatch-c752ccafd8d826b3c0c9140e89ece09e90b34cb1.zip
avoid reloading watchlets when changing order only
Diffstat (limited to 'libsowatch')
-rw-r--r--libsowatch/watchserver.cpp12
-rw-r--r--libsowatch/watchserver.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/libsowatch/watchserver.cpp b/libsowatch/watchserver.cpp
index 01af063..511c2c5 100644
--- a/libsowatch/watchserver.cpp
+++ b/libsowatch/watchserver.cpp
@@ -71,6 +71,18 @@ void WatchServer::insertWatchlet(int position, Watchlet *watchlet)
_watchletIds[id] = watchlet;
}
+void WatchServer::moveWatchlet(const Watchlet *watchlet, int to)
+{
+ const QString id = watchlet->id();
+ int index = _watchlets.indexOf(const_cast<Watchlet*>(watchlet));
+
+ Q_ASSERT(watchlet->_server == this);
+ Q_ASSERT(_watchletIds.contains(id));
+ Q_ASSERT(index >= 0);
+
+ _watchlets.move(index, to);
+}
+
void WatchServer::removeWatchlet(const Watchlet *watchlet)
{
const QString id = watchlet->id();
diff --git a/libsowatch/watchserver.h b/libsowatch/watchserver.h
index 91f9b4e..67fcb81 100644
--- a/libsowatch/watchserver.h
+++ b/libsowatch/watchserver.h
@@ -35,6 +35,7 @@ public:
void addWatchlet(Watchlet *watchlet);
void insertWatchlet(int position, Watchlet *watchlet);
+ void moveWatchlet(const Watchlet *watchlet, int to);
void removeWatchlet(const Watchlet *watchlet);
void addProvider(NotificationProvider *provider);