author | harlekin <harlekin> | 2003-03-08 22:58:57 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-08 22:58:57 (UTC) |
commit | c8425140a65f25cc83fbe08f0aa0d2f737c8f497 (patch) (unidiff) | |
tree | 96044dd814b9ae151ef887a06c2488e83e0acf8a | |
parent | 6ef522bce51f00dfd333d9e63295f3847f3dfeb5 (diff) | |
download | opie-c8425140a65f25cc83fbe08f0aa0d2f737c8f497.zip opie-c8425140a65f25cc83fbe08f0aa0d2f737c8f497.tar.gz opie-c8425140a65f25cc83fbe08f0aa0d2f737c8f497.tar.bz2 |
wrench from inline
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index c0e2ff1..3ed29e3 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -1,88 +1,88 @@ | |||
1 | #include <qpe/qpemenubar.h> | 1 | #include <qpe/qpemenubar.h> |
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qwhatsthis.h> | 5 | #include <qwhatsthis.h> |
6 | 6 | ||
7 | #include "mainwindow.h" | 7 | #include "mainwindow.h" |
8 | #include "ircservertab.h" | 8 | #include "ircservertab.h" |
9 | #include "ircserverlist.h" | 9 | #include "ircserverlist.h" |
10 | #include "ircsettings.h" | 10 | #include "ircsettings.h" |
11 | 11 | ||
12 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 12 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
13 | setCaption(tr("IRC Client")); | 13 | setCaption(tr("IRC Client")); |
14 | m_tabWidget = new IRCTabWidget(this); | 14 | m_tabWidget = new IRCTabWidget(this); |
15 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); | 15 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); |
16 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); | 16 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); |
17 | setCentralWidget(m_tabWidget); | 17 | setCentralWidget(m_tabWidget); |
18 | setToolBarsMovable(FALSE); | 18 | setToolBarsMovable(FALSE); |
19 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 19 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
20 | QPopupMenu *irc = new QPopupMenu(this); | 20 | QPopupMenu *irc = new QPopupMenu(this); |
21 | menuBar->insertItem(tr("IRC"), irc); | 21 | menuBar->insertItem(tr("IRC"), irc); |
22 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); | 22 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); |
23 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); | 23 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); |
24 | a->setWhatsThis(tr("Create a new connection to an IRC server")); | 24 | a->setWhatsThis(tr("Create a new connection to an IRC server")); |
25 | a->addTo(irc); | 25 | a->addTo(irc); |
26 | a = new QAction(tr("Settings"), Resource::loadPixmap("opieirc/settings"), QString::null, 0, this, 0); | 26 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); |
27 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); | 27 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); |
28 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | 28 | connect(a, SIGNAL(activated()), this, SLOT(settings())); |
29 | a->addTo(irc); | 29 | a->addTo(irc); |
30 | loadSettings(); | 30 | loadSettings(); |
31 | } | 31 | } |
32 | 32 | ||
33 | void MainWindow::loadSettings() { | 33 | void MainWindow::loadSettings() { |
34 | Config config("OpieIRC"); | 34 | Config config("OpieIRC"); |
35 | config.setGroup("OpieIRC"); | 35 | config.setGroup("OpieIRC"); |
36 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); | 36 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
37 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); | 37 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
38 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); | 38 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
39 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); | 39 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
40 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); | 40 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
41 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 41 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
42 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 42 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
43 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | 43 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); |
44 | } | 44 | } |
45 | 45 | ||
46 | void MainWindow::selected(QWidget *) { | 46 | void MainWindow::selected(QWidget *) { |
47 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); | 47 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
48 | } | 48 | } |
49 | 49 | ||
50 | void MainWindow::addTab(IRCTab *tab) { | 50 | void MainWindow::addTab(IRCTab *tab) { |
51 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); | 51 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); |
52 | m_tabWidget->addTab(tab, tab->title()); | 52 | m_tabWidget->addTab(tab, tab->title()); |
53 | m_tabWidget->showPage(tab); | 53 | m_tabWidget->showPage(tab); |
54 | tab->setID(m_tabWidget->currentPageIndex()); | 54 | tab->setID(m_tabWidget->currentPageIndex()); |
55 | m_tabs.append(tab); | 55 | m_tabs.append(tab); |
56 | } | 56 | } |
57 | 57 | ||
58 | void MainWindow::changeEvent(IRCTab *tab) { | 58 | void MainWindow::changeEvent(IRCTab *tab) { |
59 | if (tab->id() != m_tabWidget->currentPageIndex()) | 59 | if (tab->id() != m_tabWidget->currentPageIndex()) |
60 | m_tabWidget->setTabColor(tab->id(), blue); | 60 | m_tabWidget->setTabColor(tab->id(), blue); |
61 | } | 61 | } |
62 | 62 | ||
63 | void MainWindow::killTab(IRCTab *tab) { | 63 | void MainWindow::killTab(IRCTab *tab) { |
64 | m_tabWidget->removePage(tab); | 64 | m_tabWidget->removePage(tab); |
65 | m_tabs.remove(tab); | 65 | m_tabs.remove(tab); |
66 | /* there might be nicer ways to do this .. */ | 66 | /* there might be nicer ways to do this .. */ |
67 | delete tab; | 67 | delete tab; |
68 | } | 68 | } |
69 | 69 | ||
70 | void MainWindow::newConnection() { | 70 | void MainWindow::newConnection() { |
71 | IRCServerList list(this, "ServerList", TRUE); | 71 | IRCServerList list(this, "ServerList", TRUE); |
72 | if (list.exec() == QDialog::Accepted && list.hasServer()) { | 72 | if (list.exec() == QDialog::Accepted && list.hasServer()) { |
73 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); | 73 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); |
74 | addTab(serverTab); | 74 | addTab(serverTab); |
75 | serverTab->doConnect(); | 75 | serverTab->doConnect(); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | void MainWindow::settings() { | 79 | void MainWindow::settings() { |
80 | IRCSettings settings(this, "Settings", TRUE); | 80 | IRCSettings settings(this, "Settings", TRUE); |
81 | if (settings.exec() == QDialog::Accepted) { | 81 | if (settings.exec() == QDialog::Accepted) { |
82 | QListIterator<IRCTab> it(m_tabs); | 82 | QListIterator<IRCTab> it(m_tabs); |
83 | for (; it.current(); ++it) { | 83 | for (; it.current(); ++it) { |
84 | /* Inform all tabs about the new settings */ | 84 | /* Inform all tabs about the new settings */ |
85 | it.current()->settingsChanged(); | 85 | it.current()->settingsChanged(); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | } | 88 | } |