src/versit/versitutils.cpp
changeset 5 603d3f8b6302
parent 0 876b1a06bc25
--- a/src/versit/versitutils.cpp	Fri Sep 17 08:34:34 2010 +0300
+++ b/src/versit/versitutils.cpp	Mon Oct 04 01:37:06 2010 +0300
@@ -40,6 +40,8 @@
 ****************************************************************************/
 
 #include "versitutils_p.h"
+#include "qversitdocument.h"
+#include "qversitproperty.h"
 #include "qmobilityglobal.h"
 
 #include <QMap>
@@ -106,3 +108,19 @@
 
     m_previousCodec = codec;
 }
+
+/*!
+ * Finds a property in the \a document with the given \a propertyName, adds it to \a toBeRemoved,
+ * and returns it.
+ */
+QVersitProperty VersitUtils::takeProperty(const QVersitDocument& document,
+                                          const QString& propertyName,
+                                          QList<QVersitProperty>* toBeRemoved) {
+    foreach (const QVersitProperty& currentProperty, document.properties()) {
+        if (currentProperty.name() == propertyName) {
+            *toBeRemoved << currentProperty;
+            return currentProperty;
+        }
+    }
+    return QVersitProperty();
+}