From c4a6e9c529ea6bcb1c9a42fee33a70300f116c98 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Mon, 17 Nov 2003 15:16:13 +0000 Subject: This patch makes the famous Documents Tab customizably optional. Note that the document tab is so tight coupled to the rest of the launcher that it proved impossible for me to remove the tab as is. However I could make all the scanning and the displaying optional. The customization can be done via the launcher settings applications - a new doc tab category has been added. Further customization can be added to that tab. I also added a doc tab settings application for use with the "first usage wizard" --- (limited to 'core/settings') diff --git a/core/settings/launcher/doctabsettings.cpp b/core/settings/launcher/doctabsettings.cpp new file mode 100644 index 0000000..8077b8c --- a/dev/null +++ b/core/settings/launcher/doctabsettings.cpp @@ -0,0 +1,71 @@ +/* +                This file is part of the OPIE Project + =. Copyright (c) 2002 Trolltech AS +             .=l. Copyright (c) 2003 Michael Lauer +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU General +..}^=.=       =       ; Public License for more details. +++=   -.     .`     .: + :     =  ...= . :.=- You should have received a copy of the GNU + -.   .:....=;==+<; General Public License along with this file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#include "doctabsettings.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) +{ + QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); + + _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this ); + + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + _enable->setChecked( cfg.readBoolEntry( "Enable", true ) ); + + lay->addWidget( _enable ); + lay->addWidget( new QLabel( tr( "Note: Changing these settings may need restarting Opie to become effective." ), this ) ); + + lay->addStretch(); + + QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) ); +} + +void DocTabSettings::appletChanged() +{ +} + +void DocTabSettings::accept() +{ + qDebug( "DocTabSettings::accept()" ); + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + cfg.writeEntry( "Enable", _enable->isChecked() ); + cfg.write(); +} + diff --git a/core/settings/launcher/doctabsettings.h b/core/settings/launcher/doctabsettings.h new file mode 100644 index 0000000..ad6447c --- a/dev/null +++ b/core/settings/launcher/doctabsettings.h @@ -0,0 +1,55 @@ +/* +               =. This file is part of the OPIE Project +             .=l. Copyright (c) 2003 Michael Lauer +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU General +..}^=.=       =       ; Public License for more details. +++=   -.     .`     .: + :     =  ...= . :.=- You should have received a copy of the GNU + -.   .:....=;==+<; General Public License along with this file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef __DOCTAB_SETTINGS_H__ +#define __DOCTAB_SETTINGS_H__ + +#include + +class QCheckBox; +class QSpinBox; + +class DocTabSettings : public QWidget +{ + Q_OBJECT + + public: + DocTabSettings ( QWidget *parent = 0, const char *name = 0 ); + + void accept ( ); + + protected slots: + void appletChanged ( ); + + protected: + void init ( ); + + private: + QCheckBox* _enable; +}; + +#endif diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp index 1aa1ae8..147a00d 100644 --- a/core/settings/launcher/inputmethodsettings.cpp +++ b/core/settings/launcher/inputmethodsettings.cpp @@ -45,7 +45,7 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); - QHBoxLayout* hbox = new QHBoxLayout( this, 4, 4 ); + QHBoxLayout* hbox = new QHBoxLayout( lay, 4 ); hbox->addWidget( new QLabel( "Initial Width:", this ) ); _size = new QSpinBox( 10, 100, 10, this ); _size->setSuffix( "%" ); @@ -60,7 +60,6 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW lay->addWidget( _resize ); lay->addWidget( _float ); - lay->addLayout( hbox ); lay->addWidget( new QLabel( tr( "Note: Changing these settings may need restarting Opie to become effective." ), this ) ); lay->addStretch(); diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro index 9d05832..3261ee8 100644 --- a/core/settings/launcher/launcher.pro +++ b/core/settings/launcher/launcher.pro @@ -4,6 +4,7 @@ HEADERS = launchersettings.h \ taskbarsettings.h \ menusettings.h \ inputmethodsettings.h \ + doctabsettings.h \ tabconfig.h \ tabdialog.h @@ -13,6 +14,7 @@ SOURCES = main.cpp \ taskbarsettings.cpp \ menusettings.cpp \ inputmethodsettings.cpp \ + doctabsettings.cpp \ tabdialog.cpp INCLUDEPATH += $(OPIEDIR)/include diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp index efc4a86..e129849 100644 --- a/core/settings/launcher/launchersettings.cpp +++ b/core/settings/launcher/launchersettings.cpp @@ -36,6 +36,7 @@ #include "menusettings.h" #include "taskbarsettings.h" #include "inputmethodsettings.h" +#include "doctabsettings.h" LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) @@ -51,12 +52,13 @@ LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) m_taskbar = new TaskbarSettings ( tw ); m_menu = new MenuSettings ( tw ); m_imethods = new InputMethodSettings ( tw ); + m_doctab = new DocTabSettings ( tw ); tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); tw-> addTab ( m_menu, "go", tr( "O-Menu" )); tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" )); - + tw-> addTab ( m_doctab, "DocsIcon", tr( "DocTab" ) ); tw-> setCurrentTab ( m_taskbar ); } @@ -66,6 +68,7 @@ void LauncherSettings::accept ( ) m_menu-> accept ( ); m_tabs-> accept ( ); m_imethods-> accept ( ); + m_doctab-> accept ( ); QDialog::accept ( ); } diff --git a/core/settings/launcher/launchersettings.h b/core/settings/launcher/launchersettings.h index 7458d8b..9ba2942 100644 --- a/core/settings/launcher/launchersettings.h +++ b/core/settings/launcher/launchersettings.h @@ -34,6 +34,7 @@ class TabsSettings; class TaskbarSettings; class MenuSettings; class InputMethodSettings; +class DocTabSettings; class LauncherSettings : public QDialog { Q_OBJECT @@ -50,6 +51,7 @@ private: TaskbarSettings *m_taskbar; MenuSettings *m_menu; InputMethodSettings* m_imethods; + DocTabSettings *m_doctab; }; #endif -- cgit v0.9.0.2