Diffstat (limited to 'noncore/net/opieirc/ircsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp index 1fba030..7a1dd6c 100644 --- a/noncore/net/opieirc/ircsettings.cpp +++ b/noncore/net/opieirc/ircsettings.cpp | |||
@@ -1,61 +1,75 @@ | |||
1 | 1 | ||
2 | #include "ircsettings.h" | 2 | #include "ircsettings.h" |
3 | #include "irctab.h" | 3 | #include "irctab.h" |
4 | #include "ircmisc.h" | 4 | #include "ircmisc.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <opie2/ocolorbutton.h> | 7 | #include <opie2/ocolorbutton.h> |
8 | #include <opie2/otabwidget.h> | 8 | #include <opie2/otabwidget.h> |
9 | #include <opie2/okeyconfigwidget.h> | 9 | #include <opie2/okeyconfigwidget.h> |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | 11 | ||
12 | /* QT */ | 12 | /* QT */ |
13 | #include <qvalidator.h> | 13 | #include <qvalidator.h> |
14 | #include <qwhatsthis.h> | 14 | #include <qwhatsthis.h> |
15 | #include <qcheckbox.h> | ||
15 | 16 | ||
16 | using namespace Opie; | 17 | using namespace Opie; |
17 | using namespace Opie::Ui; | 18 | using namespace Opie::Ui; |
18 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) | 19 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) |
19 | { | 20 | { |
20 | setCaption(tr("Settings") ); | 21 | setCaption(tr("Settings") ); |
21 | m_config = new Config("OpieIRC"); | 22 | m_config = new Config("OpieIRC"); |
22 | m_config->setGroup("OpieIRC"); | 23 | m_config->setGroup("OpieIRC"); |
23 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); | 24 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); |
24 | OTabWidget *tw = new OTabWidget(this); | 25 | OTabWidget *tw = new OTabWidget(this); |
25 | l->addWidget(tw); | 26 | l->addWidget(tw); |
26 | /* General Configuration */ | 27 | /* General Configuration */ |
27 | QWidget *genwidget = new QWidget(tw); | 28 | QWidget *genwidget = new QWidget(tw); |
28 | QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0); | 29 | QGridLayout *layout = new QGridLayout(genwidget, 1, 4, 5, 0); |
29 | QLabel *label = new QLabel(tr("Lines displayed :"), genwidget); | 30 | QLabel *label = new QLabel(tr("Lines displayed :"), genwidget); |
30 | layout->addWidget(label, 0, 0); | 31 | layout->addWidget(label, 0, 0); |
31 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget); | 32 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget); |
32 | QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this")); | 33 | QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this")); |
33 | QIntValidator *validator = new QIntValidator(this); | 34 | QIntValidator *validator = new QIntValidator(this); |
34 | validator->setTop(10000); | 35 | validator->setTop(10000); |
35 | validator->setBottom(0); | 36 | validator->setBottom(0); |
36 | m_lines->setValidator(validator); | 37 | m_lines->setValidator(validator); |
37 | layout->addWidget(m_lines, 0, 1); | 38 | layout->addWidget(m_lines, 0, 1); |
39 | |||
40 | /* | ||
41 | * include timestamp | ||
42 | */ | ||
43 | m_displayTime = new QCheckBox( tr("Display time in chat log"), genwidget ); | ||
44 | m_displayTime->setChecked( m_config->readBoolEntry("DisplayTime", false) ); | ||
45 | layout->addMultiCellWidget(m_displayTime, 1, 1, 0, 4 ); | ||
46 | |||
47 | // add a spacer | ||
48 | layout->addItem( new QSpacerItem(1,1, QSizePolicy::Minimum, | ||
49 | QSizePolicy::MinimumExpanding), | ||
50 | 2, 0 ); | ||
51 | |||
38 | tw->addTab(genwidget, "opieirc/settings", tr("General")); | 52 | tw->addTab(genwidget, "opieirc/settings", tr("General")); |
39 | 53 | ||
40 | /* Color configuration */ | 54 | /* Color configuration */ |
41 | QScrollView *view = new QScrollView(this); | 55 | QScrollView *view = new QScrollView(this); |
42 | view->setResizePolicy(QScrollView::AutoOneFit); | 56 | view->setResizePolicy(QScrollView::AutoOneFit); |
43 | view->setFrameStyle( QFrame::NoFrame ); | 57 | view->setFrameStyle( QFrame::NoFrame ); |
44 | QWidget *widget = new QWidget(view->viewport()); | 58 | QWidget *widget = new QWidget(view->viewport()); |
45 | view->addChild(widget); | 59 | view->addChild(widget); |
46 | layout = new QGridLayout(widget, 7, 2, 5, 0); | 60 | layout = new QGridLayout(widget, 7, 2, 5, 0); |
47 | label = new QLabel(tr("Background color :"), widget); | 61 | label = new QLabel(tr("Background color :"), widget); |
48 | layout->addWidget(label, 0, 0); | 62 | layout->addWidget(label, 0, 0); |
49 | m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF")); | 63 | m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF")); |
50 | QWhatsThis::add(m_background, tr("Background color to be used in chats")); | 64 | QWhatsThis::add(m_background, tr("Background color to be used in chats")); |
51 | layout->addWidget(m_background, 0, 1); | 65 | layout->addWidget(m_background, 0, 1); |
52 | label = new QLabel(tr("Normal text color :"), widget); | 66 | label = new QLabel(tr("Normal text color :"), widget); |
53 | layout->addWidget(label, 1, 0); | 67 | layout->addWidget(label, 1, 0); |
54 | m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000")); | 68 | m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000")); |
55 | QWhatsThis::add(m_text, tr("Text color to be used in chats")); | 69 | QWhatsThis::add(m_text, tr("Text color to be used in chats")); |
56 | layout->addWidget(m_text, 1, 1); | 70 | layout->addWidget(m_text, 1, 1); |
57 | label = new QLabel(tr("Error color :"), widget); | 71 | label = new QLabel(tr("Error color :"), widget); |
58 | layout->addWidget(label, 2, 0); | 72 | layout->addWidget(label, 2, 0); |
59 | m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000")); | 73 | m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000")); |
60 | QWhatsThis::add(m_error, tr("Text color to be used to display errors")); | 74 | QWhatsThis::add(m_error, tr("Text color to be used to display errors")); |
61 | layout->addWidget(m_error, 2, 1); | 75 | layout->addWidget(m_error, 2, 1); |
@@ -96,33 +110,35 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
96 | QPEApplication::showDialog( this ); | 110 | QPEApplication::showDialog( this ); |
97 | } | 111 | } |
98 | 112 | ||
99 | void IRCSettings::accept() | 113 | void IRCSettings::accept() |
100 | { | 114 | { |
101 | IRCTab::m_backgroundColor = m_background->color().name(); | 115 | IRCTab::m_backgroundColor = m_background->color().name(); |
102 | IRCTab::m_textColor = m_text->color().name(); | 116 | IRCTab::m_textColor = m_text->color().name(); |
103 | IRCTab::m_errorColor = m_error->color().name(); | 117 | IRCTab::m_errorColor = m_error->color().name(); |
104 | IRCTab::m_selfColor = m_self->color().name(); | 118 | IRCTab::m_selfColor = m_self->color().name(); |
105 | IRCTab::m_otherColor = m_other->color().name(); | 119 | IRCTab::m_otherColor = m_other->color().name(); |
106 | IRCTab::m_serverColor = m_server->color().name(); | 120 | IRCTab::m_serverColor = m_server->color().name(); |
107 | IRCTab::m_notificationColor = m_notification->color().name(); | 121 | IRCTab::m_notificationColor = m_notification->color().name(); |
108 | IRCTab::m_maxLines = m_lines->text().toInt(); | 122 | IRCTab::m_maxLines = m_lines->text().toInt(); |
109 | m_keyConf->save(); | 123 | m_keyConf->save(); |
110 | 124 | ||
111 | 125 | ||
112 | m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); | 126 | m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); |
113 | m_config->writeEntry("TextColor", IRCTab::m_textColor); | 127 | m_config->writeEntry("TextColor", IRCTab::m_textColor); |
114 | m_config->writeEntry("ErrorColor", IRCTab::m_errorColor); | 128 | m_config->writeEntry("ErrorColor", IRCTab::m_errorColor); |
115 | m_config->writeEntry("SelfColor", IRCTab::m_selfColor); | 129 | m_config->writeEntry("SelfColor", IRCTab::m_selfColor); |
116 | m_config->writeEntry("OtherColor", IRCTab::m_otherColor); | 130 | m_config->writeEntry("OtherColor", IRCTab::m_otherColor); |
117 | m_config->writeEntry("ServerColor", IRCTab::m_serverColor); | 131 | m_config->writeEntry("ServerColor", IRCTab::m_serverColor); |
118 | m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor); | 132 | m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor); |
119 | m_config->writeEntry("Lines", m_lines->text()); | 133 | m_config->writeEntry("Lines", m_lines->text()); |
134 | m_config->writeEntry("DisplayTime", m_displayTime->isChecked() ); | ||
135 | IRCTab::setUseTimeStamps(m_displayTime->isChecked()); | ||
120 | IRCHistoryLineEdit::keyConfigInstance()->save(); | 136 | IRCHistoryLineEdit::keyConfigInstance()->save(); |
121 | 137 | ||
122 | QDialog::accept(); | 138 | QDialog::accept(); |
123 | } | 139 | } |
124 | 140 | ||
125 | IRCSettings::~IRCSettings() | 141 | IRCSettings::~IRCSettings() |
126 | { | 142 | { |
127 | delete m_config; | 143 | delete m_config; |
128 | } | 144 | } |