Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index 3d60107..5edcf66 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -1,84 +1,88 @@ | |||
1 | #include <qmenubar.h> | ||
2 | #include <qpe/resource.h> | ||
3 | 1 | ||
4 | #include <opie2/odebug.h> | 2 | #include <opie2/odebug.h> |
3 | #include <opie2/oresource.h> | ||
5 | 4 | ||
5 | #include <qmenubar.h> | ||
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | 7 | ||
8 | #include "mainwindow.h" | 8 | #include "mainwindow.h" |
9 | #include "ircservertab.h" | 9 | #include "ircservertab.h" |
10 | #include "dcctransfertab.h" | 10 | #include "dcctransfertab.h" |
11 | #include "ircserverlist.h" | 11 | #include "ircserverlist.h" |
12 | #include "ircsettings.h" | 12 | #include "ircsettings.h" |
13 | 13 | ||
14 | #include <stdio.h> | 14 | #include <stdio.h> |
15 | 15 | ||
16 | 16 | ||
17 | QString MainWindow::appCaption() { | 17 | QString MainWindow::appCaption() { |
18 | return QObject::tr("Opie IRC"); | 18 | return QObject::tr("Opie IRC"); |
19 | } | 19 | } |
20 | 20 | ||
21 | 21 | ||
22 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 22 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
23 | setCaption(tr("IRC Client")); | 23 | setCaption(tr("IRC Client")); |
24 | m_tabWidget = new IRCTabWidget(this); | 24 | m_tabWidget = new IRCTabWidget(this); |
25 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); | 25 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); |
26 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*))); | 26 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*))); |
27 | setCentralWidget(m_tabWidget); | 27 | setCentralWidget(m_tabWidget); |
28 | setToolBarsMovable(FALSE); | 28 | setToolBarsMovable(FALSE); |
29 | QMenuBar *menuBar = new QMenuBar(this); | 29 | QMenuBar *menuBar = new QMenuBar(this); |
30 | QPopupMenu *irc = new QPopupMenu(this); | 30 | QPopupMenu *irc = new QPopupMenu(this); |
31 | menuBar->insertItem(tr("IRC"), irc); | 31 | menuBar->insertItem(tr("IRC"), irc); |
32 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); | 32 | QAction *a = new QAction( tr("New connection"), |
33 | Opie::Core::OResource::loadPixmap( "pass", Opie::Core::OResource::SmallIcon ), | ||
34 | QString::null, 0, this, 0 ); | ||
33 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); | 35 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); |
34 | a->setWhatsThis(tr("Create a new connection to an IRC server")); | 36 | a->setWhatsThis(tr("Create a new connection to an IRC server")); |
35 | a->addTo(irc); | 37 | a->addTo(irc); |
36 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); | 38 | a = new QAction( tr("Settings"), |
39 | Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), | ||
40 | QString::null, 0, this, 0 ); | ||
37 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); | 41 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); |
38 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | 42 | connect(a, SIGNAL(activated()), this, SLOT(settings())); |
39 | a->addTo(irc); | 43 | a->addTo(irc); |
40 | m_dccTab = 0; | 44 | m_dccTab = 0; |
41 | loadSettings(); | 45 | loadSettings(); |
42 | } | 46 | } |
43 | 47 | ||
44 | /*IRCTabWidget MainWindow::getTabWidget(){ | 48 | /*IRCTabWidget MainWindow::getTabWidget(){ |
45 | return m_tabWidget; | 49 | return m_tabWidget; |
46 | } */ | 50 | } */ |
47 | 51 | ||
48 | void MainWindow::loadSettings() { | 52 | void MainWindow::loadSettings() { |
49 | Config config("OpieIRC"); | 53 | Config config("OpieIRC"); |
50 | config.setGroup("OpieIRC"); | 54 | config.setGroup("OpieIRC"); |
51 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); | 55 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
52 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); | 56 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
53 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); | 57 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
54 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); | 58 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
55 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); | 59 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
56 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 60 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
57 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 61 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
58 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | 62 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); |
59 | IRCTab::setUseTimeStamps( config.readBoolEntry("DisplayTime", false ) ); | 63 | IRCTab::setUseTimeStamps( config.readBoolEntry("DisplayTime", false ) ); |
60 | } | 64 | } |
61 | 65 | ||
62 | void MainWindow::selected(QWidget *) { | 66 | void MainWindow::selected(QWidget *) { |
63 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); | 67 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
64 | emit updateScroll(); | 68 | emit updateScroll(); |
65 | } | 69 | } |
66 | 70 | ||
67 | void MainWindow::addTab(IRCTab *tab) { | 71 | void MainWindow::addTab(IRCTab *tab) { |
68 | connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); | 72 | connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); |
69 | connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&))); | 73 | connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&))); |
70 | connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab())); | 74 | connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab())); |
71 | connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab())); | 75 | connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab())); |
72 | 76 | ||
73 | m_tabWidget->addTab(tab, tab->title()); | 77 | m_tabWidget->addTab(tab, tab->title()); |
74 | m_tabWidget->showPage(tab); | 78 | m_tabWidget->showPage(tab); |
75 | tab->setID(m_tabWidget->currentPageIndex()); | 79 | tab->setID(m_tabWidget->currentPageIndex()); |
76 | m_tabs.append(tab); | 80 | m_tabs.append(tab); |
77 | } | 81 | } |
78 | 82 | ||
79 | void MainWindow::changeEvent(IRCTab *tab) { | 83 | void MainWindow::changeEvent(IRCTab *tab) { |
80 | if (tab->id() != m_tabWidget->currentPageIndex()) | 84 | if (tab->id() != m_tabWidget->currentPageIndex()) |
81 | m_tabWidget->setTabColor(tab->id(), blue); | 85 | m_tabWidget->setTabColor(tab->id(), blue); |
82 | } | 86 | } |
83 | 87 | ||
84 | void MainWindow::killTab(IRCTab *tab, bool imediate) { | 88 | void MainWindow::killTab(IRCTab *tab, bool imediate) { |