summaryrefslogtreecommitdiff
path: root/core/settings/launcher/tabssettings.cpp
Unidiff
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
@@ -47,6 +47,8 @@
47#include <qmessagebox.h> 47#include <qmessagebox.h>
48 48
49 49
50 #define GLOBALID "_launchersettings_global_dummy_"
51
50 52
51TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 53TabsSettings::TabsSettings ( QWidget *parent, const char *name )
52 : QWidget ( parent, name ) 54 : QWidget ( parent, name )
@@ -61,31 +63,43 @@ TabsSettings::TabsSettings ( QWidget *parent, const char *name )
61 63
62 QWhatsThis::add ( m_list, tr( "foobar" )); 64 QWhatsThis::add ( m_list, tr( "foobar" ));
63 65
64 QPushButton *p; 66 QPushButton *p1, *p2, *p3;
65 p = new QPushButton ( tr( "New" ), this ); 67 p1 = new QPushButton ( tr( "New" ), this );
66 lay-> addWidget ( p, 1, 1 ); 68 lay-> addWidget ( p1, 1, 1 );
67 connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); 69 connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
68 70
69 p = new QPushButton ( tr( "Edit" ), this ); 71 p2 = new QPushButton ( tr( "Edit" ), this );
70 lay-> addWidget ( p, 2, 1 ); 72 lay-> addWidget ( p2, 2, 1 );
71 connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); 73 connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
72 74
73 p = new QPushButton ( tr( "Delete" ), this ); 75 p3 = new QPushButton ( tr( "Delete" ), this );
74 lay-> addWidget ( p, 3, 1 ); 76 lay-> addWidget ( p3, 3, 1 );
75 connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); 77 connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
76 78
77 lay-> setRowStretch ( 4, 10 ); 79 lay-> setRowStretch ( 4, 10 );
78 80
79 m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this ); 81 m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this );
80 lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 ); 82 lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 );
81 83
84 p1-> setEnabled ( false );
85 p3-> setEnabled ( false );
86
82 init ( ); 87 init ( );
88
89 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." ));
90 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>." ));
91 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." ));
92 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
93 QWhatsThis::add ( m_busyblink, tr( "Activate this, if you want a blinking busy indicator for starting applications in the Launcher." ));
83} 94}
84 95
85void TabsSettings::init ( ) 96void TabsSettings::init ( )
86{ 97{
87 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 98 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
88 QStringList types = rootFolder. types ( ); 99 QStringList types = rootFolder. types ( );
100
101 m_list-> insertItem ( tr( "All Tabs" ));
102 m_ids << GLOBALID;
89 103
90 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 104 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
91 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); 105 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
@@ -117,6 +131,8 @@ void TabsSettings::readTabSettings ( Config &cfg )
117 tc. m_changed = false; 131 tc. m_changed = false;
118 132
119 cfg. setGroup ( grp. arg ( *it )); 133 cfg. setGroup ( grp. arg ( *it ));
134 if ( *it == GLOBALID )
135 cfg. clearGroup ( );
120 136
121 QString view = cfg. readEntry ( "View", "Icon" ); 137 QString view = cfg. readEntry ( "View", "Icon" );
122 if ( view == "List" ) // No tr 138 if ( view == "List" ) // No tr
@@ -143,8 +159,25 @@ void TabsSettings::readTabSettings ( Config &cfg )
143 tc. m_font_weight = 50; 159 tc. m_font_weight = 50;
144 tc. m_font_italic = false; 160 tc. m_font_italic = false;
145 } 161 }
162
146 m_tabs [*it] = tc; 163 m_tabs [*it] = tc;
147 } 164 }
165
166 // if all tabs have the same config, then initialize the GLOBALID tab to these values
167
168 TabConfig *first = 0;
169 bool same = true;
170
171 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
172 if ( *it == GLOBALID )
173 continue;
174 else if ( !first )
175 first = &m_tabs [*it];
176 else
177 same &= ( *first == m_tabs [*it] );
178 }
179 if ( same )
180 m_tabs [GLOBALID] = *first;
148} 181}
149 182
150 183
@@ -158,9 +191,10 @@ void TabsSettings::accept ( )
158 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 191 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
159 TabConfig &tc = m_tabs [*it]; 192 TabConfig &tc = m_tabs [*it];
160 193
161 cfg. setGroup ( grp. arg ( *it )); 194 if ( !tc. m_changed || ( *it == GLOBALID ))
162 if ( !tc. m_changed )
163 continue; 195 continue;
196
197 cfg. setGroup ( grp. arg ( *it ));
164 switch ( tc. m_view ) { 198 switch ( tc. m_view ) {
165 case TabConfig::Icon: 199 case TabConfig::Icon:
166 cfg.writeEntry ( "View", "Icon" ); 200 cfg.writeEntry ( "View", "Icon" );
@@ -246,6 +280,13 @@ void TabsSettings::editClicked ( )
246 if ( d-> exec ( ) == QDialog::Accepted ) { 280 if ( d-> exec ( ) == QDialog::Accepted ) {
247 tc. m_changed = true; 281 tc. m_changed = true;
248 m_tabs [m_ids [ind]] = tc; 282 m_tabs [m_ids [ind]] = tc;
283
284 if ( m_ids [ind] == GLOBALID ) {
285 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
286 if ( *it != GLOBALID )
287 m_tabs [*it] = tc;
288 }
289 }
249 } 290 }
250 291
251 delete d; 292 delete d;