~ubuntu-branches/ubuntu/lucid/kdebase/lucid

« back to all changes in this revision

Viewing changes to apps/plasma/applets/folderview/previewpluginsmodel.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-12-02 13:28:20 UTC
  • mto: This revision was merged to the branch mainline in revision 258.
  • Revision ID: james.westby@ubuntu.com-20091202132820-tpxn348l9frx5zd5
Tags: upstream-4.3.80
ImportĀ upstreamĀ versionĀ 4.3.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <QStringList>
21
21
#include "previewpluginsmodel.h"
22
22
 
 
23
static bool lessThan(const KService::Ptr &a, const KService::Ptr &b)
 
24
{
 
25
    return QString::localeAwareCompare(a->name(), b->name()) < 0;
 
26
}
 
27
 
23
28
PreviewPluginsModel::PreviewPluginsModel(QObject *parent)
24
29
    : QAbstractListModel(parent)
25
30
{
26
31
    plugins = KServiceTypeTrader::self()->query("ThumbCreator");
27
32
 
28
33
    // Sort the list alphabetially
29
 
    QMap<QString, KSharedPtr<KService> > map;
30
 
    for (int i = 0; i < plugins.size(); i++) {
31
 
        map.insert(plugins[i]->name().toLower(), plugins[i]);
32
 
    }
33
 
    plugins = map.values();
 
34
    qStableSort(plugins.begin(), plugins.end(), lessThan);
34
35
}
35
36
 
36
37
PreviewPluginsModel::~PreviewPluginsModel()