-rw-r--r-- | noncore/net/opieirc/ircmisc.cpp | 44 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.h | 14 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 20 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.h | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.cpp | 9 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 1 |
6 files changed, 84 insertions, 8 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp index df6f874..9b9bff8 100644 --- a/noncore/net/opieirc/ircmisc.cpp +++ b/noncore/net/opieirc/ircmisc.cpp | |||
@@ -4,4 +4,7 @@ | |||
4 | #include <opie2/odebug.h> | 4 | #include <opie2/odebug.h> |
5 | #include <opie2/oconfig.h> | ||
6 | #include <opie2/okeyconfigmanager.h> | ||
5 | using namespace Opie::Core; | 7 | using namespace Opie::Core; |
6 | 8 | ||
9 | |||
7 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { | 10 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { |
@@ -44,2 +47,31 @@ void IRCTabWidget::setTabColor(int index, QColor color) { | |||
44 | 47 | ||
48 | |||
49 | static OKeyConfigManager* s_manager = 0; | ||
50 | OKeyConfigManager* IRCHistoryLineEdit::keyConfigInstance() { | ||
51 | if ( !s_manager ) { | ||
52 | /* | ||
53 | * black list with the DeviceButtons as default | ||
54 | * because we do not grab the keyboard and they | ||
55 | * wouldn't work | ||
56 | */ | ||
57 | OKeyPair::List blackList = OKeyPair::hardwareKeys(); | ||
58 | blackList.append( OKeyPair::returnKey() ); | ||
59 | blackList.append( OKeyPair::leftArrowKey() ); | ||
60 | blackList.append( OKeyPair::upArrowKey() ); | ||
61 | blackList.append( OKeyPair::downArrowKey() ); | ||
62 | |||
63 | s_manager = new OKeyConfigManager(new OConfig("opieirc-keys"), | ||
64 | "keys", blackList, | ||
65 | false, 0, "irc_history_line_keyconfigm" ); | ||
66 | s_manager->addKeyConfig( OKeyConfigItem( tr("Next Tab"), "next_tab", QPixmap(), | ||
67 | KeyNextTab, OKeyPair(Qt::Key_N, Qt::ControlButton) )); | ||
68 | s_manager->addKeyConfig( OKeyConfigItem( tr("Previous Tab"), "prev_tab", QPixmap(), | ||
69 | KeyPrevTab, OKeyPair(Qt::Key_P, Qt::ControlButton) )); | ||
70 | s_manager->load(); | ||
71 | } | ||
72 | |||
73 | return s_manager; | ||
74 | } | ||
75 | |||
76 | |||
45 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { | 77 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { |
@@ -68,11 +100,13 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { | |||
68 | m_index = -1; | 100 | m_index = -1; |
69 | } else if (key == Key_N && event->state() == Qt::ControlButton) { | 101 | } |
102 | |||
103 | switch( keyConfigInstance()->handleKeyEventId( event ) ) { | ||
104 | case KeyNextTab: | ||
70 | emit nextTab(); | 105 | emit nextTab(); |
71 | return; | 106 | return; |
72 | } else if ( ( key == Key_Y || key == Key_Z ) && event->state() == Qt::ControlButton) { | 107 | case KeyPrevTab: |
73 | emit closeTab(); | ||
74 | return; | ||
75 | } else if (key == Key_P && event->state() == Qt::ControlButton) { | ||
76 | emit prevTab(); | 108 | emit prevTab(); |
77 | return; | 109 | return; |
110 | default: | ||
111 | break; | ||
78 | } | 112 | } |
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h index c42dcbd..37eed28 100644 --- a/noncore/net/opieirc/ircmisc.h +++ b/noncore/net/opieirc/ircmisc.h | |||
@@ -30,2 +30,9 @@ | |||
30 | 30 | ||
31 | namespace Opie { | ||
32 | namespace Core { | ||
33 | class OKeyConfigManager; | ||
34 | } | ||
35 | } | ||
36 | |||
37 | |||
31 | /* Custom colored QTabWidget */ | 38 | /* Custom colored QTabWidget */ |
@@ -61,2 +68,9 @@ class IRCHistoryLineEdit : public QLineEdit { | |||
61 | public: | 68 | public: |
69 | enum KeyMode { | ||
70 | KeyNextTab, | ||
71 | KeyPrevTab | ||
72 | }; | ||
73 | |||
74 | static Opie::Core::OKeyConfigManager* keyConfigInstance(); | ||
75 | |||
62 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); | 76 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); |
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp index 13fcc24..1fba030 100644 --- a/noncore/net/opieirc/ircsettings.cpp +++ b/noncore/net/opieirc/ircsettings.cpp | |||
@@ -3,2 +3,3 @@ | |||
3 | #include "irctab.h" | 3 | #include "irctab.h" |
4 | #include "ircmisc.h" | ||
4 | 5 | ||
@@ -7,2 +8,3 @@ | |||
7 | #include <opie2/otabwidget.h> | 8 | #include <opie2/otabwidget.h> |
9 | #include <opie2/okeyconfigwidget.h> | ||
8 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
@@ -80,4 +82,15 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
80 | tw->addTab(view, "opieirc/colors", tr("Colors")); | 82 | tw->addTab(view, "opieirc/colors", tr("Colors")); |
81 | tw->setCurrentTab( genwidget ); | ||
82 | 83 | ||
84 | |||
85 | /* | ||
86 | * IRC EditLine KeyConfiguration | ||
87 | */ | ||
88 | m_keyConf = new Opie::Ui::OKeyConfigWidget(tw, "KEyConfig GUI" ); | ||
89 | m_keyConf->setChangeMode( OKeyConfigWidget::Queue ); | ||
90 | m_keyConf->insert( tr("Keyboard Shortcuts"), | ||
91 | IRCHistoryLineEdit::keyConfigInstance() ); | ||
92 | m_keyConf->load(); | ||
93 | tw->addTab(m_keyConf, "SettingsIcon", tr("Keyboard Shortcuts") ); | ||
94 | |||
95 | tw->setCurrentTab( genwidget ); | ||
83 | QPEApplication::showDialog( this ); | 96 | QPEApplication::showDialog( this ); |
@@ -95,2 +108,5 @@ void IRCSettings::accept() | |||
95 | IRCTab::m_maxLines = m_lines->text().toInt(); | 108 | IRCTab::m_maxLines = m_lines->text().toInt(); |
109 | m_keyConf->save(); | ||
110 | |||
111 | |||
96 | m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); | 112 | m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); |
@@ -103,2 +119,4 @@ void IRCSettings::accept() | |||
103 | m_config->writeEntry("Lines", m_lines->text()); | 119 | m_config->writeEntry("Lines", m_lines->text()); |
120 | IRCHistoryLineEdit::keyConfigInstance()->save(); | ||
121 | |||
104 | QDialog::accept(); | 122 | QDialog::accept(); |
diff --git a/noncore/net/opieirc/ircsettings.h b/noncore/net/opieirc/ircsettings.h index 56e667b..a032aff 100644 --- a/noncore/net/opieirc/ircsettings.h +++ b/noncore/net/opieirc/ircsettings.h | |||
@@ -29,2 +29,5 @@ namespace Opie { | |||
29 | class OColorButton; | 29 | class OColorButton; |
30 | namespace Ui { | ||
31 | class OKeyConfigWidget; | ||
32 | } | ||
30 | } | 33 | } |
@@ -47,2 +50,3 @@ protected: | |||
47 | Opie::OColorButton *m_notification; | 50 | Opie::OColorButton *m_notification; |
51 | Opie::Ui::OKeyConfigWidget *m_keyConf; | ||
48 | QLineEdit *m_lines; | 52 | QLineEdit *m_lines; |
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp index 8e1dc16..2b3ecd4 100644 --- a/noncore/net/opieirc/irctab.cpp +++ b/noncore/net/opieirc/irctab.cpp | |||
@@ -1,6 +1,11 @@ | |||
1 | #include "irctab.h" | ||
2 | #include "mainwindow.h" | ||
3 | |||
4 | #include <opie2/okeyconfigmanager.h> | ||
1 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
6 | |||
7 | |||
2 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
3 | #include <qwhatsthis.h> | 9 | #include <qwhatsthis.h> |
4 | #include "irctab.h" | 10 | |
5 | #include "mainwindow.h" | ||
6 | 11 | ||
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index 1143213..2e674c5 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -78,2 +78,3 @@ void MainWindow::killTab(IRCTab *tab) { | |||
78 | m_tabs.remove(tab); | 78 | m_tabs.remove(tab); |
79 | |||
79 | /* there might be nicer ways to do this .. */ | 80 | /* there might be nicer ways to do this .. */ |