]> cloud.milkyroute.net Git - dolphin.git/commitdiff
insert the meta text information alphabetically sorted
authorPeter Penz <peter.penz19@gmail.com>
Tue, 10 Mar 2009 19:36:55 +0000 (19:36 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 10 Mar 2009 19:36:55 +0000 (19:36 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=937920

src/panels/information/metatextlabel.cpp

index 94ed226669fb485d9259794c385d697cd3a09e18..baa4d03278d7920fa3548d9d83dfc9fc249b7bca 100644 (file)
@@ -51,7 +51,20 @@ void MetaTextLabel::add(const QString& labelText, const QString& infoText)
     MetaInfo metaInfo;
     metaInfo.label = labelText;
     metaInfo.info = infoText;
     MetaInfo metaInfo;
     metaInfo.label = labelText;
     metaInfo.info = infoText;
-    m_metaInfos.append(metaInfo);
+
+    // add the meta information alphabetically sorted
+    bool inserted = false;
+    const int count = m_metaInfos.size();
+    for (int i = 0; i < count; ++i) {
+        if (m_metaInfos[i].label > labelText) {
+            m_metaInfos.insert(i, metaInfo);
+            inserted = true;
+            break;
+        }
+    }
+    if (!inserted) {
+        m_metaInfos.append(metaInfo);
+    }
 
     setMinimumHeight(minimumHeight() + requiredHeight(metaInfo));
     update();
 
     setMinimumHeight(minimumHeight() + requiredHeight(metaInfo));
     update();