~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to parts/uimode/uichooser_widget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
  uichooser_widget.cpp - ?
3
 
                             -------------------
4
 
    begin                : ?
5
 
    copyright            : (C) 2003 by the KDevelop team
6
 
    email                : team@kdevelop.org
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
11
 
 *   This program is free software; you can redistribute it and/or modify  *
12
 
 *   it under the terms of the GNU General Public License as published by  *
13
 
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 
 *   (at your option) any later version.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
 
18
 
#include <qradiobutton.h>
19
 
#include <qbuttongroup.h>
20
 
#include <qcheckbox.h>
21
 
#include <kapplication.h>
22
 
#include <kconfig.h>
23
 
#include <kdebug.h>
24
 
#include <kdeversion.h>
25
 
 
26
 
#include "uichooser_part.h"
27
 
#include "kdevmainwindow.h"
28
 
#include "uichooser_widget.h"
29
 
 
30
 
UIChooserWidget::UIChooserWidget( UIChooserPart * part, QWidget *parent, const char *name)
31
 
  : UIChooser(parent, name)
32
 
  ,m_part(part), _lastMode(0L)
33
 
{
34
 
  load();
35
 
}
36
 
 
37
 
void UIChooserWidget::load()
38
 
{
39
 
  KConfig *config = kapp->config();
40
 
  config->setGroup("UI");
41
 
 
42
 
        int mdistyle = config->readNumEntry( "MDIStyle", 1 );
43
 
        switch( mdistyle )
44
 
        {
45
 
                case 0:
46
 
                        IconsOnly->setChecked( true );
47
 
                        break;
48
 
                case 1:
49
 
                        TextOnly->setChecked( true );
50
 
                        break;
51
 
                case 3:
52
 
                        TextAndIcons->setChecked( true );
53
 
                        break;
54
 
                default:
55
 
                        TextOnly->setChecked( true );
56
 
        }
57
 
 
58
 
        int tabVisibility = config->readNumEntry( "TabWidgetVisibility", _AlwaysShowTabs );
59
 
        switch( tabVisibility )
60
 
        {
61
 
                case _AlwaysShowTabs:
62
 
                        AlwaysShowTabs->setChecked( true );
63
 
                        break;
64
 
                case _NeverShowTabs:
65
 
                        NeverShowTabs->setChecked( true );
66
 
                        break;
67
 
        }
68
 
 
69
 
        bool CloseOnHover = config->readBoolEntry( "CloseOnHover", false );
70
 
 
71
 
        if ( CloseOnHover )
72
 
        {
73
 
                DoCloseOnHover->setChecked( true );
74
 
        }
75
 
        else
76
 
        {
77
 
                DoNotCloseOnHover->setChecked( true );
78
 
        }
79
 
        OpenNewTabAfterCurrent->setChecked(config->readBoolEntry( "OpenNewTabAfterCurrent", false ));
80
 
        ShowTabIcons->setChecked(config->readBoolEntry( "ShowTabIcons", true ));
81
 
        ShowCloseTabsButton->setChecked(config->readBoolEntry( "ShowCloseTabsButton", true ));
82
 
 
83
 
        maybeEnableCloseOnHover(false);
84
 
}
85
 
 
86
 
 
87
 
void UIChooserWidget::save()
88
 
{
89
 
  KConfig *config = kapp->config();
90
 
  config->setGroup("UI");
91
 
 
92
 
        if ( AlwaysShowTabs->isChecked() )
93
 
        {
94
 
                config->writeEntry( "TabWidgetVisibility", _AlwaysShowTabs );
95
 
        }
96
 
        else if ( NeverShowTabs->isChecked() )
97
 
        {
98
 
                config->writeEntry( "TabWidgetVisibility", _NeverShowTabs );
99
 
        }
100
 
 
101
 
        if ( DoNotCloseOnHover->isChecked() )
102
 
        {
103
 
                config->writeEntry( "CloseOnHover", false );
104
 
        }
105
 
        else if ( DoCloseOnHover->isChecked() )
106
 
        {
107
 
                config->writeEntry( "CloseOnHover", true );
108
 
        }
109
 
 
110
 
        // using magic numbers for now.. where are these values defined??
111
 
        if ( IconsOnly->isChecked() )
112
 
        {
113
 
                config->writeEntry( "MDIStyle", 0 );
114
 
        }
115
 
        else if ( TextAndIcons->isChecked() )
116
 
        {
117
 
                config->writeEntry( "MDIStyle", 3 );
118
 
        }
119
 
        else // TextOnly
120
 
        {
121
 
                config->writeEntry( "MDIStyle", 1 );
122
 
        }
123
 
        config->writeEntry("OpenNewTabAfterCurrent", OpenNewTabAfterCurrent->isChecked());
124
 
        config->writeEntry("ShowTabIcons", ShowTabIcons->isChecked());
125
 
        config->writeEntry("ShowCloseTabsButton", ShowCloseTabsButton->isChecked());
126
 
 
127
 
        config->sync();
128
 
}
129
 
 
130
 
 
131
 
void UIChooserWidget::accept()
132
 
{
133
 
  save();
134
 
}
135
 
 
136
 
void UIChooserWidget::maybeEnableCloseOnHover( bool )
137
 
{
138
 
        if ( !NeverShowTabs->isChecked() && !ShowTabIcons->isChecked())
139
 
        {
140
 
                HoverCloseGroup->setEnabled(false);
141
 
        } else if ( NeverShowTabs->isChecked() )
142
 
        {
143
 
                HoverCloseGroup->setEnabled( false );
144
 
                TabbedBrowsingGroup->setEnabled( false );
145
 
        } else
146
 
        {
147
 
                HoverCloseGroup->setEnabled( true );
148
 
                TabbedBrowsingGroup->setEnabled( true );
149
 
        }
150
 
}
151
 
 
152
 
 
153
 
#include "uichooser_widget.moc"