1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
/***************************************************************************
uichooser_widget.cpp - ?
-------------------
begin : ?
copyright : (C) 2003 by the KDevelop team
email : team@tdevelop.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 <tqradiobutton.h>
#include <tqbuttongroup.h>
#include <tqcheckbox.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <tdeversion.h>
#include "uichooser_part.h"
#include "kdevmainwindow.h"
#include "uichooser_widget.h"
UIChooserWidget::UIChooserWidget( UIChooserPart * part, TQWidget *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"
|