summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/styles/theme/themeset.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/styles/theme/themeset.cpp b/noncore/styles/theme/themeset.cpp
index 4a4efcb..d4005bc 100644
--- a/noncore/styles/theme/themeset.cpp
+++ b/noncore/styles/theme/themeset.cpp
@@ -20,104 +20,105 @@
#include "themeset.h"
#include <qpe/qpeapplication.h>
#include <qpe/global.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlistview.h>
#include <qdir.h>
#include <qpe/config.h>
class MyConfig : public Config
{
public:
MyConfig ( const QString &f, Domain d ) : Config ( f, d )
{ }
bool hasGroup ( const QString &gname ) const
{
QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname );
return ( it != groups.end() );
}
};
class MyItem : public QListViewItem
{
public:
- MyItem ( QListView *lv, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, name, comm )
+ MyItem ( QListView *lv, QListViewItem *after, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, after, name, comm )
{
m_theme = theme;
}
QString m_theme;
};
ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl )
: QWidget ( parent, name, fl )
{
setCaption ( tr( "Theme Style" ) );
Config config ( "qpe" );
config. setGroup ( "Appearance" );
QString active = config. readEntry ( "Theme", "default" );
QVBoxLayout *vbox = new QVBoxLayout ( this );
vbox-> setSpacing ( 3 );
vbox-> setMargin ( 6 );
vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this ));
m_list = new QListView ( this );
m_list-> addColumn ( tr( "Name" ));
m_list-> addColumn ( tr( "Description" ));
m_list-> setSelectionMode ( QListView::Single );
m_list-> setAllColumnsShowFocus ( true );
+ m_list-> setSorting ( -1 );
vbox-> addWidget ( m_list, 10 );
- QListViewItem *item = new MyItem ( m_list, tr( "[No theme]" ), "", "" );
+ QListViewItem *item = new MyItem ( m_list, 0, tr( "[No theme]" ), "", "" );
m_list-> setSelected ( item, true );
QString path = QPEApplication::qpeDir() + "/plugins/styles/themes";
QStringList list = QDir ( path, "*.themerc" ). entryList ( );
for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) {
MyConfig cfg ( path + "/" + *it, Config::File );
if ( cfg. hasGroup ( "Misc" )) {
cfg. setGroup ( "Misc" );
QString name = cfg. readEntry ( "Name" );
QString comm = cfg. readEntry ( "Comment" );
if ( !name. isEmpty ( )) {
QString fname = (*it). left ((*it). length ( ) - 8 );
- item = new MyItem ( m_list, name, comm, fname );
+ item = new MyItem ( m_list, item, name, comm, fname );
if ( active == fname ) {
m_list-> setSelected ( item, true );
}
}
}
}
}
bool ThemeSettings::writeConfig ( )
{
Config config ( "qpe" );
config. setGroup ( "Appearance" );
MyItem *it = (MyItem *) m_list-> selectedItem ( );
config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" ));
config. write ( );
return true;
}