Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/MapThemeSortFilterProxyModel.cpp
1 | // | 1 | // | ||
---|---|---|---|---|---|
2 | // This file is part of the Marble Virtual Globe. | 2 | // This file is part of the Marble Virtual Globe. | ||
3 | // | 3 | // | ||
4 | // This program is free software licensed under the GNU LGPL. You can | 4 | // This program is free software licensed under the GNU LGPL. You can | ||
5 | // find a copy of this license in LICENSE.txt in the top directory of | 5 | // find a copy of this license in LICENSE.txt in the top directory of | ||
6 | // the source code. | 6 | // the source code. | ||
7 | // | 7 | // | ||
8 | // Copyright 2008 Claudiu Covaci <claudiu.covaci@gmail.com> | 8 | // Copyright 2008 Claudiu Covaci <claudiu.covaci@gmail.com> | ||
9 | // Copyright 2009 Torsten Rahn <tackat@kde.org> | 9 | // Copyright 2009 Torsten Rahn <tackat@kde.org> | ||
10 | // | 10 | // | ||
11 | 11 | | |||
12 | #include "config-marble.h" | ||||
12 | #include "MapThemeSortFilterProxyModel.h" | 13 | #include "MapThemeSortFilterProxyModel.h" | ||
13 | 14 | | |||
14 | #include <QString> | 15 | #include <QString> | ||
15 | #include <QModelIndex> | 16 | #include <QModelIndex> | ||
16 | #include <QDateTime> | 17 | #include <QDateTime> | ||
17 | #include <QSettings> | 18 | #include <QSettings> | ||
18 | 19 | | |||
19 | /* TRANSLATOR Marble::MapThemeSortFilterProxyModel */ | 20 | /* TRANSLATOR Marble::MapThemeSortFilterProxyModel */ | ||
Show All 27 Lines | 46 | { | |||
47 | return (sourceModel()->data( index, Qt::UserRole + 1 ).toString().contains( filterRegExp() ) ); | 48 | return (sourceModel()->data( index, Qt::UserRole + 1 ).toString().contains( filterRegExp() ) ); | ||
48 | } | 49 | } | ||
49 | 50 | | |||
50 | bool MapThemeSortFilterProxyModel::isFavorite( const QModelIndex& index ) | 51 | bool MapThemeSortFilterProxyModel::isFavorite( const QModelIndex& index ) | ||
51 | { | 52 | { | ||
52 | const QAbstractItemModel *model = index.model(); | 53 | const QAbstractItemModel *model = index.model(); | ||
53 | QModelIndex columnIndex = model->index( index.row(), 0, QModelIndex() ); | 54 | QModelIndex columnIndex = model->index( index.row(), 0, QModelIndex() ); | ||
54 | QString const key = QLatin1String("Favorites/") + model->data(columnIndex).toString(); | 55 | QString const key = QLatin1String("Favorites/") + model->data(columnIndex).toString(); | ||
56 | #ifdef APPLE_STANDARD_UNIX_BUILD | ||||
57 | QSettings::setDefaultFormat(QSettings::IniFormat); | ||||
58 | #endif | ||||
55 | return QSettings().contains( key ); | 59 | return QSettings().contains( key ); | ||
56 | } | 60 | } | ||
57 | 61 | | |||
58 | QDateTime MapThemeSortFilterProxyModel::favoriteDateTime( const QModelIndex& index ) | 62 | QDateTime MapThemeSortFilterProxyModel::favoriteDateTime( const QModelIndex& index ) | ||
59 | { | 63 | { | ||
60 | const QAbstractItemModel *model = index.model(); | 64 | const QAbstractItemModel *model = index.model(); | ||
61 | QModelIndex columnIndex = model->index( index.row(), 0, QModelIndex() ); | 65 | QModelIndex columnIndex = model->index( index.row(), 0, QModelIndex() ); | ||
62 | QString const key = QLatin1String("Favorites/") + model->data(columnIndex).toString(); | 66 | QString const key = QLatin1String("Favorites/") + model->data(columnIndex).toString(); | ||
67 | #ifdef APPLE_STANDARD_UNIX_BUILD | ||||
68 | QSettings::setDefaultFormat(QSettings::IniFormat); | ||||
69 | #endif | ||||
63 | return QSettings().value( key ).toDateTime(); | 70 | return QSettings().value( key ).toDateTime(); | ||
64 | } | 71 | } | ||
65 | 72 | | |||
66 | } | 73 | } | ||
67 | 74 | | |||
68 | #include "moc_MapThemeSortFilterProxyModel.cpp" | 75 | #include "moc_MapThemeSortFilterProxyModel.cpp" |