summaryrefslogtreecommitdiff
authorwazlaf <wazlaf>2002-09-20 23:52:11 (UTC)
committer wazlaf <wazlaf>2002-09-20 23:52:11 (UTC)
commit0f3593c79658beef09155d71b5877a230e9bbb62 (patch) (unidiff)
tree51e258fb055957a655b9cc6479721e7614036c2a
parentfb146186b2c0cef47927a75cb431713aa08da6f8 (diff)
downloadopie-0f3593c79658beef09155d71b5877a230e9bbb62.zip
opie-0f3593c79658beef09155d71b5877a230e9bbb62.tar.gz
opie-0f3593c79658beef09155d71b5877a230e9bbb62.tar.bz2
new icon, menu fixed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/irctab.cpp2
-rw-r--r--noncore/net/opieirc/mainwindow.cpp13
-rw-r--r--noncore/net/opieirc/mainwindow.h2
3 files changed, 1 insertions, 16 deletions
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp
index 36976ab..653a5de 100644
--- a/noncore/net/opieirc/irctab.cpp
+++ b/noncore/net/opieirc/irctab.cpp
@@ -1,19 +1,19 @@
1#include <qpe/resource.h> 1#include <qpe/resource.h>
2#include <qpixmap.h> 2#include <qpixmap.h>
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include "irctab.h" 4#include "irctab.h"
5 5
6IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { 6IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
7 m_layout = new QVBoxLayout(this); 7 m_layout = new QVBoxLayout(this);
8 QHBoxLayout *descLayout = new QHBoxLayout(m_layout); 8 QHBoxLayout *descLayout = new QHBoxLayout(m_layout);
9 descLayout->setMargin(5); 9 descLayout->setMargin(5);
10 m_description = new QLabel(tr("Missing description"), this); 10 m_description = new QLabel(tr("Missing description"), this);
11 descLayout->addWidget(m_description); 11 descLayout->addWidget(m_description);
12 descLayout->setStretchFactor(m_description, 5); 12 descLayout->setStretchFactor(m_description, 5);
13 QPushButton *close = new QPushButton(this); 13 QPushButton *close = new QPushButton(this);
14 close->setPixmap(Resource::loadPixmap("opieirc/close")); 14 close->setPixmap(Resource::loadPixmap("close"));
15 connect(close, SIGNAL(clicked()), this, SLOT(remove())); 15 connect(close, SIGNAL(clicked()), this, SLOT(remove()));
16 descLayout->addWidget(close); 16 descLayout->addWidget(close);
17 descLayout->setStretchFactor(m_description, 1); 17 descLayout->setStretchFactor(m_description, 1);
18} 18}
19 19
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 3d13ee9..af4ce78 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -6,59 +6,46 @@
6#include "mainwindow.h" 6#include "mainwindow.h"
7#include "ircservertab.h" 7#include "ircservertab.h"
8#include "ircserverlist.h" 8#include "ircserverlist.h"
9 9
10MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { 10MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) {
11 setCaption(tr("IRC Client")); 11 setCaption(tr("IRC Client"));
12 m_tabWidget = new QTabWidget(this); 12 m_tabWidget = new QTabWidget(this);
13 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabSelected(QWidget *))); 13 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabSelected(QWidget *)));
14 setCentralWidget(m_tabWidget); 14 setCentralWidget(m_tabWidget);
15 setToolBarsMovable(FALSE); 15 setToolBarsMovable(FALSE);
16 QPEMenuBar *menuBar = new QPEMenuBar(this); 16 QPEMenuBar *menuBar = new QPEMenuBar(this);
17 QPopupMenu *irc = new QPopupMenu(this); 17 QPopupMenu *irc = new QPopupMenu(this);
18 menuBar->insertItem(tr("IRC"), irc); 18 menuBar->insertItem(tr("IRC"), irc);
19 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); 19 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
20 connect(a, SIGNAL(activated()), this, SLOT(newConnection())); 20 connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
21 a->addTo(irc); 21 a->addTo(irc);
22
23 m_joinAction = new QAction(tr("Join channel"), Resource::loadPixmap("forward"), QString::null, 0, this, 0);
24 m_joinAction->setEnabled(FALSE);
25 connect(m_joinAction, SIGNAL(activated()), this, SLOT(join()));
26 m_joinAction->addTo(irc);
27} 22}
28 23
29void MainWindow::tabSelected(QWidget *) { 24void MainWindow::tabSelected(QWidget *) {
30 m_joinAction->setEnabled(TRUE);
31} 25}
32 26
33void MainWindow::closeTab() { 27void MainWindow::closeTab() {
34 /* Does not directly close the tab but triggers an action 28 /* Does not directly close the tab but triggers an action
35 which at some point will close the tab using a callback */ 29 which at some point will close the tab using a callback */
36 IRCTab *tab = (IRCTab *)m_tabWidget->currentPage(); 30 IRCTab *tab = (IRCTab *)m_tabWidget->currentPage();
37 if (tab) { 31 if (tab) {
38 tab->remove(); 32 tab->remove();
39 } 33 }
40} 34}
41 35
42void MainWindow::join() {
43 IRCTab *tab = (IRCTab *)m_tabWidget->currentPage();
44 if (tab) {
45 tab->session()->join("#opie.de");
46 }
47}
48
49void MainWindow::addTab(IRCTab *tab) { 36void MainWindow::addTab(IRCTab *tab) {
50 m_tabWidget->addTab(tab, tab->title()); 37 m_tabWidget->addTab(tab, tab->title());
51 m_tabWidget->showPage(tab); 38 m_tabWidget->showPage(tab);
52 tabSelected(tab); 39 tabSelected(tab);
53} 40}
54 41
55void MainWindow::killTab(IRCTab *tab) { 42void MainWindow::killTab(IRCTab *tab) {
56 m_tabWidget->removePage(tab); 43 m_tabWidget->removePage(tab);
57 /* there might be nicer ways to do this .. */ 44 /* there might be nicer ways to do this .. */
58 delete tab; 45 delete tab;
59} 46}
60 47
61void MainWindow::newConnection() { 48void MainWindow::newConnection() {
62 IRCServerList list(this, "ServerList", TRUE); 49 IRCServerList list(this, "ServerList", TRUE);
63 if (list.exec() == QDialog::Accepted && list.hasServer()) { 50 if (list.exec() == QDialog::Accepted && list.hasServer()) {
64 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); 51 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget);
diff --git a/noncore/net/opieirc/mainwindow.h b/noncore/net/opieirc/mainwindow.h
index c197f5b..dcb782f 100644
--- a/noncore/net/opieirc/mainwindow.h
+++ b/noncore/net/opieirc/mainwindow.h
@@ -24,24 +24,22 @@
24#include <qmainwindow.h> 24#include <qmainwindow.h>
25#include <qaction.h> 25#include <qaction.h>
26#include <qtabwidget.h> 26#include <qtabwidget.h>
27#include "mainwindow.h" 27#include "mainwindow.h"
28#include "irctab.h" 28#include "irctab.h"
29 29
30class MainWindow : public QMainWindow { 30class MainWindow : public QMainWindow {
31 Q_OBJECT 31 Q_OBJECT
32public: 32public:
33 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0); 33 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
34 34
35 void addTab(IRCTab *tab); 35 void addTab(IRCTab *tab);
36 void killTab(IRCTab *tab); 36 void killTab(IRCTab *tab);
37protected slots: 37protected slots:
38 void newConnection(); 38 void newConnection();
39 void closeTab(); 39 void closeTab();
40 void join();
41 void tabSelected(QWidget *widget); 40 void tabSelected(QWidget *widget);
42protected: 41protected:
43 QTabWidget *m_tabWidget; 42 QTabWidget *m_tabWidget;
44 QAction *m_joinAction;
45}; 43};
46 44
47#endif /* __MAINWINDOW_H */ 45#endif /* __MAINWINDOW_H */