2
This program is free software; you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation; either version 2 of the License, or
5
(at your option) any later version.
9
Copyright (C) 2006 John Tapsell <johnflux@gmail.com>
10
Copyright (C) 2006 Eike Hein <hein@kde.org>
13
#include "config-konversation.h"
14
#include "settingsdialog.h"
15
#include "configdialog.h"
16
#include "preferences.h"
17
#include "ui_chatwindowappearance_config.h"
18
#include "connectionbehavior_config.h"
19
#include "highlight_config.h"
20
#include "warnings_config.h"
21
#include "ui_log_config.h"
22
#include "quickbuttons_config.h"
23
#include "autoreplace_config.h"
24
#include "ui_chatwindowbehaviour_config.h"
25
#include "ui_fontappearance_config.h"
26
#include "nicklistbehavior_config.h"
27
#include "tabs_config.h"
28
#include "ui_colorsappearance_config.h"
29
#include "ui_generalbehavior_configui.h"
30
#include "dcc_config.h"
31
#include "osd_config.h"
32
#include "theme_config.h"
33
#include "alias_config.h"
34
#include "ignore_config.h"
35
#include "watchednicknames_config.h"
36
#include "ui_tabnotifications_config.h"
38
#include <config-konversation.h>
40
#ifdef HAVE_INDICATEQT
41
#include "ui_messageindicator_config.h"
45
KonviSettingsDialog::KonviSettingsDialog( QWidget *parent) :
46
KonviConfigDialog( parent, "settings", Preferences::self(), KPageDialog::Tree)
51
KPageWidgetItem *interfaceGroup = new KPageWidgetItem(new QWidget(this), i18n("Interface"));
52
interfaceGroup->setIcon(KIcon("preferences-desktop-theme"));
53
KPageDialog::addPage(interfaceGroup);
55
KPageWidgetItem *behaviorGroup = new KPageWidgetItem(new QWidget(this), i18n("Behavior"));
56
behaviorGroup->setIcon(KIcon("configure"));
57
KPageDialog::addPage(behaviorGroup);
59
KPageWidgetItem *notificationGroup = new KPageWidgetItem(new QWidget(this), i18n("Notifications"));
60
notificationGroup->setIcon(KIcon("preferences-desktop-notification"));
61
KPageDialog::addPage(notificationGroup);
63
//Interface/Chat Window
64
Ui::ChatWindowAppearance_Config confChatWindowAppearance;
66
confChatWindowAppearance.setupUi(w);
67
confChatWindowAppearance.kcfg_TimestampFormat->addItem("hh:mm");
68
confChatWindowAppearance.kcfg_TimestampFormat->addItem("hh:mm:ss");
69
confChatWindowAppearance.kcfg_TimestampFormat->addItem("h:m ap");
70
addPage(w, interfaceGroup, "view-list-text", i18n("Chat Window"));
73
m_confThemeWdg = new Theme_Config( this, "Theme" );
74
addPage ( m_confThemeWdg, interfaceGroup, "preferences-desktop-icons", i18n("Nicklist Themes") );
75
m_pages.append(m_confThemeWdg);
76
connect(m_confThemeWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
79
Ui::ColorsAppearance_Config confColorsAppearance;
81
confColorsAppearance.setupUi(w);
82
addPage(w, interfaceGroup, "preferences-desktop-color", i18n("Colors"));
85
Ui::FontAppearance_Config confFontAppearance;
87
confFontAppearance.setupUi(w);
88
addPage(w, interfaceGroup, "preferences-desktop-font", i18n("Fonts"));
90
//Interface/Quick Buttons
91
m_confQuickButtonsWdg = new QuickButtons_Config( this, "QuickButtons" );
92
addPage ( m_confQuickButtonsWdg, interfaceGroup, "preferences-desktop-keyboard", i18n("Quick Buttons") );
93
m_pages.append(m_confQuickButtonsWdg);
94
connect(m_confQuickButtonsWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
97
m_confTabBarWdg = new Tabs_Config( this, "TabBar" );
98
addPage ( m_confTabBarWdg, interfaceGroup, "tab-new", i18n("Tabs") );
101
Ui::GeneralBehavior_ConfigUI confGeneralBehavior;
103
confGeneralBehavior.setupUi(w);
104
#ifdef HAVE_KSTATUSNOTIFIERITEM
105
confGeneralBehavior.kcfg_TrayNotifyBlink->setVisible(false);
106
confGeneralBehavior.horizontalLayout_2->removeItem(confGeneralBehavior.spacer51_2);
107
confGeneralBehavior.horizontalLayout_2->setEnabled(false);
109
addPage( w, behaviorGroup, "configure", i18n("General") );
111
//Behavior/Connection
112
ConnectionBehavior_Config* confConnectionBehavior = new ConnectionBehavior_Config(this);
113
confConnectionBehavior->setObjectName("ConnectionBehavior");
114
addPage(confConnectionBehavior, behaviorGroup, "network-connect", i18n("Connection"));
115
m_pages.append(confConnectionBehavior);
117
//Behaviour/Chat Window
118
Ui::ChatwindowBehaviour_Config confChatwindowBehaviour;
120
confChatwindowBehaviour.setupUi(w);
121
confChatwindowBehaviour.kcfg_ScrollbackMax->setToolTip(i18np("Maximum scrollback limit: 1 line.",
122
"Maximum scrollback limit: %1 lines.", confChatwindowBehaviour.kcfg_ScrollbackMax->maximum()));
123
confChatwindowBehaviour.kcfg_ScrollbackMax->setSuffix(ki18np(" line", " lines"));
124
confChatwindowBehaviour.kcfg_AutoWhoNicksLimit->setSuffix(ki18np(" nick", " nicks"));
125
confChatwindowBehaviour.kcfg_AutoWhoContinuousInterval->setSuffix(ki18np(" second", " seconds"));
126
addPage(w, behaviorGroup, "view-list-text", i18n("Chat Window"));
128
//Behaviour/Nickname List
129
m_confNicklistBehaviorWdg = new NicklistBehavior_Config( this, "NicklistBehavior" );
130
addPage ( m_confNicklistBehaviorWdg, behaviorGroup, "preferences-contact-list", i18n("Nickname List") );
131
connect(m_confNicklistBehaviorWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
132
m_pages.append(m_confNicklistBehaviorWdg);
134
//Behaviour/Command Aliases
135
m_confAliasWdg = new Alias_Config( this, "Alias" );
136
addPage ( m_confAliasWdg, behaviorGroup, "edit-rename", i18n("Command Aliases") );
137
m_pages.append(m_confAliasWdg);
138
connect(m_confAliasWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
140
//Behaviour/Auto Replace
141
m_confAutoreplaceWdg = new Autoreplace_Config( this, "Autoreplace" );
142
addPage ( m_confAutoreplaceWdg, behaviorGroup, "edit-rename", i18n("Auto Replace") );
143
m_pages.append(m_confAutoreplaceWdg);
144
connect(m_confAutoreplaceWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
147
m_confIgnoreWdg = new Ignore_Config(this, "Ignore");
148
addPage ( m_confIgnoreWdg, behaviorGroup, "process-stop", i18n("Ignore") );
149
connect(m_confIgnoreWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
150
m_pages.append(m_confIgnoreWdg);
153
Ui::Log_Config confLog;
156
confLog.kcfg_LogfilePath->setMode(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly);
157
addPage(w, behaviorGroup, "text-plain", i18n("Logging"));
159
m_confDCCWdg = new DCC_Config( this, "DCC" );
160
addPage ( m_confDCCWdg, behaviorGroup, "arrow-right-double", i18n("DCC") );
162
//Notifications/Tab Bar
163
Ui::TabNotifications_Config confTabNotifications;
165
confTabNotifications.setupUi(w);
166
addPage(w, notificationGroup, "tab-new", i18n("Tabs"));
168
//Notification/Highlighting
169
m_confHighlightWdg = new Highlight_Config( this, "Highlight" );
170
addPage ( m_confHighlightWdg, notificationGroup, "flag-red", i18n("Highlight") );
171
connect(m_confHighlightWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
172
m_pages.append(m_confHighlightWdg);
174
//Notification/Watched Nicknames
175
m_confWatchedNicknamesWdg = new WatchedNicknames_Config( this, "WatchedNicknames" );
176
// remember index so we can open this page later from outside
177
m_watchedNicknamesPage = addPage ( m_confWatchedNicknamesWdg, notificationGroup, "edit-find-user", i18n("Watched Nicknames") );
178
connect(m_confWatchedNicknamesWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
179
m_pages.append(m_confWatchedNicknamesWdg);
181
//Notification/On Screen Display
182
m_confOSDWdg = new OSD_Config( this, "OSD" );
183
addPage ( m_confOSDWdg, notificationGroup, "video-display", i18n("On Screen Display") );
184
//no modified connection needed - it's all kcfg widgets
185
m_pages.append(m_confOSDWdg);
187
#ifdef HAVE_INDICATEQT
188
//Notification/Message Indicator
189
Ui::MessageIndicator_Config confMessageIndicator;
191
confMessageIndicator.setupUi(w);
192
addPage(w, notificationGroup, "mail-unread-new", i18n("Message Indicator"));
195
//Notification/Warning Dialogs
196
m_confWarningsWdg = new Warnings_Config( this, "Warnings" );
197
addPage ( m_confWarningsWdg, notificationGroup, "dialog-warning", i18n("Warning Dialogs") );
198
m_pages.append(m_confWarningsWdg);
199
connect(m_confWarningsWdg, SIGNAL(modified()), this, SLOT(modifiedSlot()));
202
void KonviSettingsDialog::modifiedSlot()
204
// this is for the non KConfigXT parts to tell us, if the user actually changed
205
// something or went back to the old settings
208
foreach (KonviSettingsPage *page, m_pages)
210
if (page->hasChanged())
213
// kDebug() << "modified!";
220
KonviSettingsDialog::~KonviSettingsDialog()
224
void KonviSettingsDialog::updateSettings()
226
foreach (KonviSettingsPage *page, m_pages)
228
// this is for the non KConfigXT parts to update the UI (like quick buttons)
229
page->saveSettings();
232
emit settingsChanged();
235
void KonviSettingsDialog::updateWidgets()
237
foreach (KonviSettingsPage *page, m_pages)
239
page->loadSettings();
244
void KonviSettingsDialog::updateWidgetsDefault()
246
foreach (KonviSettingsPage *page, m_pages)
248
page->restorePageToDefaults();
253
void KonviSettingsDialog::openWatchedNicknamesPage()
255
// page index has been calculated in the constructor
256
setCurrentPage(m_watchedNicknamesPage);
259
// accessor method - will be used by KonviConfigDialog::updateButtons()
260
bool KonviSettingsDialog::hasChanged()
265
// accessor method - will be used by KonviConfigDialog::updateButtons()
266
bool KonviSettingsDialog::isDefault()
271
#include "settingsdialog.moc"