summaryrefslogtreecommitdiff
path: root/lib/kolabaccount.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kolabaccount.cpp')
-rw-r--r--lib/kolabaccount.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/kolabaccount.cpp b/lib/kolabaccount.cpp
index a395f2f..5925fc5 100644
--- a/lib/kolabaccount.cpp
+++ b/lib/kolabaccount.cpp
@@ -415,3 +415,29 @@ QStringList KolabAccount::lookupFolderList()
return mailboxes;
}
+void KolabAccount::setRegextrans(const QStringList &regextrans)
+{
+ foreach (const QString &transformation, regextrans) {
+ if (!transformation.startsWith("s/") || !transformation.endsWith("/")) {
+ Warning() << "invalid transformation: " << transformation;
+ continue;
+ }
+ QString trans = transformation.mid(2, transformation.length() - 3);
+ const int separator = trans.indexOf("/");
+ const QString searchString = trans.left(separator);
+ const QString replaceString = trans.right(separator+1);
+ Debug() << "s/" << searchString << "/" << replaceString;
+ mRegextrans.insert(searchString, replaceString);
+ }
+}
+
+QString KolabAccount::applyTargetFolderTransformations(const QString &folder) const
+{
+ QString newName(folder);
+ foreach (const QString &searchString, mRegextrans.keys()) {
+ if (folder.contains(searchString)) {
+ return mRegextrans.value(searchString);
+ }
+ }
+ return newName;
+}