summaryrefslogtreecommitdiff
path: root/core/settings/launcher/tabssettings.cpp
Side-by-side diff
Diffstat (limited to 'core/settings/launcher/tabssettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/tabssettings.cpp65
1 files changed, 53 insertions, 12 deletions
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 6cc69c0..a5afaf2 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -38,63 +38,77 @@
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwhatsthis.h>
#include <qcheckbox.h>
#include "tabdialog.h"
#include <stdlib.h>
#include <qmessagebox.h>
+#define GLOBALID "_launchersettings_global_dummy_"
+
TabsSettings::TabsSettings ( QWidget *parent, const char *name )
: QWidget ( parent, name )
{
QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
m_list = new QListBox ( this );
lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
QWhatsThis::add ( m_list, tr( "foobar" ));
- QPushButton *p;
- p = new QPushButton ( tr( "New" ), this );
- lay-> addWidget ( p, 1, 1 );
- connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
+ QPushButton *p1, *p2, *p3;
+ p1 = new QPushButton ( tr( "New" ), this );
+ lay-> addWidget ( p1, 1, 1 );
+ connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
- p = new QPushButton ( tr( "Edit" ), this );
- lay-> addWidget ( p, 2, 1 );
- connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
+ p2 = new QPushButton ( tr( "Edit" ), this );
+ lay-> addWidget ( p2, 2, 1 );
+ connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
- p = new QPushButton ( tr( "Delete" ), this );
- lay-> addWidget ( p, 3, 1 );
- connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
+ p3 = new QPushButton ( tr( "Delete" ), this );
+ lay-> addWidget ( p3, 3, 1 );
+ connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
lay-> setRowStretch ( 4, 10 );
m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this );
lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 );
+ p1-> setEnabled ( false );
+ p3-> setEnabled ( false );
+
init ( );
+
+ QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." ));
+ QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
+ QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." ));
+ QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
+ QWhatsThis::add ( m_busyblink, tr( "Activate this, if you want a blinking busy indicator for starting applications in the Launcher." ));
}
void TabsSettings::init ( )
{
AppLnkSet rootFolder( MimeType::appsFolderName ( ));
QStringList types = rootFolder. types ( );
+
+ m_list-> insertItem ( tr( "All Tabs" ));
+ m_ids << GLOBALID;
for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
m_ids << *it;
}
QImage img ( Resource::loadImage ( "DocsIcon" ));
QPixmap pix;
pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
m_list-> insertItem ( pix, tr( "Documents" ));
m_ids += "Documents"; // No tr
Config cfg ( "Launcher" );
@@ -108,24 +122,26 @@ void TabsSettings::init ( )
void TabsSettings::readTabSettings ( Config &cfg )
{
QString grp ( "Tab %1" ); // No tr
m_tabs. clear ( );
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig tc;
tc. m_view = TabConfig::Icon;
tc. m_bg_type = TabConfig::Ruled;
tc. m_changed = false;
cfg. setGroup ( grp. arg ( *it ));
+ if ( *it == GLOBALID )
+ cfg. clearGroup ( );
QString view = cfg. readEntry ( "View", "Icon" );
if ( view == "List" ) // No tr
tc. m_view = TabConfig::List;
QString bgType = cfg. readEntry ( "BackgroundType", "Image" );
if ( bgType == "SolidColor" )
tc. m_bg_type = TabConfig::SolidColor;
else if ( bgType == "Image" ) // No tr
tc. m_bg_type = TabConfig::Image;
tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" );
@@ -134,42 +150,60 @@ void TabsSettings::readTabSettings ( Config &cfg )
QStringList f = cfg. readListEntry ( "Font", ',' );
if ( f. count ( ) == 4 ) {
tc. m_font_family = f [0];
tc. m_font_size = f [1]. toInt ( );
tc. m_font_weight = f [2]. toInt ( );
tc. m_font_italic = ( f [3]. toInt ( ));
} else {
tc. m_font_family = font ( ). family ( );
tc. m_font_size = font ( ). pointSize ( );
tc. m_font_weight = 50;
tc. m_font_italic = false;
}
+
m_tabs [*it] = tc;
}
+
+ // if all tabs have the same config, then initialize the GLOBALID tab to these values
+
+ TabConfig *first = 0;
+ bool same = true;
+
+ for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
+ if ( *it == GLOBALID )
+ continue;
+ else if ( !first )
+ first = &m_tabs [*it];
+ else
+ same &= ( *first == m_tabs [*it] );
+ }
+ if ( same )
+ m_tabs [GLOBALID] = *first;
}
void TabsSettings::accept ( )
{
Config cfg ( "Launcher" );
// Launcher Tab
QString grp ( "Tab %1" ); // No tr
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig &tc = m_tabs [*it];
- cfg. setGroup ( grp. arg ( *it ));
- if ( !tc. m_changed )
+ if ( !tc. m_changed || ( *it == GLOBALID ))
continue;
+
+ cfg. setGroup ( grp. arg ( *it ));
switch ( tc. m_view ) {
case TabConfig::Icon:
cfg.writeEntry ( "View", "Icon" );
break;
case TabConfig::List:
cfg.writeEntry ( "View", "List" );
break;
}
QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
e << *it << tc. m_view;
@@ -237,16 +271,23 @@ void TabsSettings::editClicked ( )
if ( ind < 0 )
return;
TabConfig tc = m_tabs [m_ids [ind]];
TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
d-> showMaximized ( );
if ( d-> exec ( ) == QDialog::Accepted ) {
tc. m_changed = true;
m_tabs [m_ids [ind]] = tc;
+
+ if ( m_ids [ind] == GLOBALID ) {
+ for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
+ if ( *it != GLOBALID )
+ m_tabs [*it] = tc;
+ }
+ }
}
delete d;
}