summaryrefslogtreecommitdiffstats
path: root/parts/uimode/uichooser_widget.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /parts/uimode/uichooser_widget.cpp
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/uimode/uichooser_widget.cpp')
-rw-r--r--parts/uimode/uichooser_widget.cpp153
1 files changed, 153 insertions, 0 deletions
diff --git a/parts/uimode/uichooser_widget.cpp b/parts/uimode/uichooser_widget.cpp
new file mode 100644
index 00000000..5e6ffbf7
--- /dev/null
+++ b/parts/uimode/uichooser_widget.cpp
@@ -0,0 +1,153 @@
+/***************************************************************************
+ uichooser_widget.cpp - ?
+ -------------------
+ begin : ?
+ copyright : (C) 2003 by the KDevelop team
+ email : team@kdevelop.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdeversion.h>
+
+#include "uichooser_part.h"
+#include "kdevmainwindow.h"
+#include "uichooser_widget.h"
+
+UIChooserWidget::UIChooserWidget( UIChooserPart * part, QWidget *parent, const char *name)
+ : UIChooser(parent, name)
+ ,m_part(part), _lastMode(0L)
+{
+ load();
+}
+
+void UIChooserWidget::load()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("UI");
+
+ int mdistyle = config->readNumEntry( "MDIStyle", 1 );
+ switch( mdistyle )
+ {
+ case 0:
+ IconsOnly->setChecked( true );
+ break;
+ case 1:
+ TextOnly->setChecked( true );
+ break;
+ case 3:
+ TextAndIcons->setChecked( true );
+ break;
+ default:
+ TextOnly->setChecked( true );
+ }
+
+ int tabVisibility = config->readNumEntry( "TabWidgetVisibility", _AlwaysShowTabs );
+ switch( tabVisibility )
+ {
+ case _AlwaysShowTabs:
+ AlwaysShowTabs->setChecked( true );
+ break;
+ case _NeverShowTabs:
+ NeverShowTabs->setChecked( true );
+ break;
+ }
+
+ bool CloseOnHover = config->readBoolEntry( "CloseOnHover", false );
+
+ if ( CloseOnHover )
+ {
+ DoCloseOnHover->setChecked( true );
+ }
+ else
+ {
+ DoNotCloseOnHover->setChecked( true );
+ }
+ OpenNewTabAfterCurrent->setChecked(config->readBoolEntry( "OpenNewTabAfterCurrent", false ));
+ ShowTabIcons->setChecked(config->readBoolEntry( "ShowTabIcons", true ));
+ ShowCloseTabsButton->setChecked(config->readBoolEntry( "ShowCloseTabsButton", true ));
+
+ maybeEnableCloseOnHover(false);
+}
+
+
+void UIChooserWidget::save()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("UI");
+
+ if ( AlwaysShowTabs->isChecked() )
+ {
+ config->writeEntry( "TabWidgetVisibility", _AlwaysShowTabs );
+ }
+ else if ( NeverShowTabs->isChecked() )
+ {
+ config->writeEntry( "TabWidgetVisibility", _NeverShowTabs );
+ }
+
+ if ( DoNotCloseOnHover->isChecked() )
+ {
+ config->writeEntry( "CloseOnHover", false );
+ }
+ else if ( DoCloseOnHover->isChecked() )
+ {
+ config->writeEntry( "CloseOnHover", true );
+ }
+
+ // using magic numbers for now.. where are these values defined??
+ if ( IconsOnly->isChecked() )
+ {
+ config->writeEntry( "MDIStyle", 0 );
+ }
+ else if ( TextAndIcons->isChecked() )
+ {
+ config->writeEntry( "MDIStyle", 3 );
+ }
+ else // TextOnly
+ {
+ config->writeEntry( "MDIStyle", 1 );
+ }
+ config->writeEntry("OpenNewTabAfterCurrent", OpenNewTabAfterCurrent->isChecked());
+ config->writeEntry("ShowTabIcons", ShowTabIcons->isChecked());
+ config->writeEntry("ShowCloseTabsButton", ShowCloseTabsButton->isChecked());
+
+ config->sync();
+}
+
+
+void UIChooserWidget::accept()
+{
+ save();
+}
+
+void UIChooserWidget::maybeEnableCloseOnHover( bool )
+{
+ if ( !NeverShowTabs->isChecked() && !ShowTabIcons->isChecked())
+ {
+ HoverCloseGroup->setEnabled(false);
+ } else if ( NeverShowTabs->isChecked() )
+ {
+ HoverCloseGroup->setEnabled( false );
+ TabbedBrowsingGroup->setEnabled( false );
+ } else
+ {
+ HoverCloseGroup->setEnabled( true );
+ TabbedBrowsingGroup->setEnabled( true );
+ }
+}
+
+
+#include "uichooser_widget.moc"