summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp44
-rw-r--r--noncore/net/opieirc/ircmisc.h14
-rw-r--r--noncore/net/opieirc/ircsettings.cpp20
-rw-r--r--noncore/net/opieirc/ircsettings.h4
-rw-r--r--noncore/net/opieirc/irctab.cpp9
-rw-r--r--noncore/net/opieirc/mainwindow.cpp1
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
@@ -2,8 +2,11 @@
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/oconfig.h>
+#include <opie2/okeyconfigmanager.h>
using namespace Opie::Core;
+
IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
}
@@ -42,6 +45,35 @@ void IRCTabWidget::setTabColor(int index, QColor color) {
}
+
+static OKeyConfigManager* s_manager = 0;
+OKeyConfigManager* IRCHistoryLineEdit::keyConfigInstance() {
+ if ( !s_manager ) {
+ /*
+ * black list with the DeviceButtons as default
+ * because we do not grab the keyboard and they
+ * wouldn't work
+ */
+ OKeyPair::List blackList = OKeyPair::hardwareKeys();
+ blackList.append( OKeyPair::returnKey() );
+ blackList.append( OKeyPair::leftArrowKey() );
+ blackList.append( OKeyPair::upArrowKey() );
+ blackList.append( OKeyPair::downArrowKey() );
+
+ s_manager = new OKeyConfigManager(new OConfig("opieirc-keys"),
+ "keys", blackList,
+ false, 0, "irc_history_line_keyconfigm" );
+ s_manager->addKeyConfig( OKeyConfigItem( tr("Next Tab"), "next_tab", QPixmap(),
+ KeyNextTab, OKeyPair(Qt::Key_N, Qt::ControlButton) ));
+ s_manager->addKeyConfig( OKeyConfigItem( tr("Previous Tab"), "prev_tab", QPixmap(),
+ KeyPrevTab, OKeyPair(Qt::Key_P, Qt::ControlButton) ));
+ s_manager->load();
+ }
+
+ return s_manager;
+}
+
+
IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
m_index = -1;
installEventFilter(this);
@@ -66,15 +98,17 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
} else if (key == Key_Return) {
m_history.prepend(text());
m_index = -1;
- } else if (key == Key_N && event->state() == Qt::ControlButton) {
+ }
+
+ switch( keyConfigInstance()->handleKeyEventId( event ) ) {
+ case KeyNextTab:
emit nextTab();
return;
- } else if ( ( key == Key_Y || key == Key_Z ) && event->state() == Qt::ControlButton) {
- emit closeTab();
- return;
- } else if (key == Key_P && event->state() == Qt::ControlButton) {
+ case KeyPrevTab:
emit prevTab();
return;
+ default:
+ break;
}
QLineEdit::keyPressEvent(event);
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
@@ -28,6 +28,13 @@
#include <qcolor.h>
#include <qarray.h>
+namespace Opie {
+namespace Core {
+class OKeyConfigManager;
+}
+}
+
+
/* Custom colored QTabWidget */
class QExtTab : public QTab {
@@ -59,6 +66,13 @@ protected:
class IRCHistoryLineEdit : public QLineEdit {
Q_OBJECT
public:
+ enum KeyMode {
+ KeyNextTab,
+ KeyPrevTab
+ };
+
+ static Opie::Core::OKeyConfigManager* keyConfigInstance();
+
IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0);
virtual bool eventFilter(QObject *object, QEvent *event);
public slots:
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
@@ -1,10 +1,12 @@
#include "ircsettings.h"
#include "irctab.h"
+#include "ircmisc.h"
/* OPIE */
#include <opie2/ocolorbutton.h>
#include <opie2/otabwidget.h>
+#include <opie2/okeyconfigwidget.h>
#include <qpe/qpeapplication.h>
/* QT */
@@ -78,8 +80,19 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags)
QWhatsThis::add(m_notification, tr("Text color to be used to display notifications"));
layout->addWidget(m_notification, 6, 1);
tw->addTab(view, "opieirc/colors", tr("Colors"));
- tw->setCurrentTab( genwidget );
+
+ /*
+ * IRC EditLine KeyConfiguration
+ */
+ m_keyConf = new Opie::Ui::OKeyConfigWidget(tw, "KEyConfig GUI" );
+ m_keyConf->setChangeMode( OKeyConfigWidget::Queue );
+ m_keyConf->insert( tr("Keyboard Shortcuts"),
+ IRCHistoryLineEdit::keyConfigInstance() );
+ m_keyConf->load();
+ tw->addTab(m_keyConf, "SettingsIcon", tr("Keyboard Shortcuts") );
+
+ tw->setCurrentTab( genwidget );
QPEApplication::showDialog( this );
}
@@ -93,6 +106,9 @@ void IRCSettings::accept()
IRCTab::m_serverColor = m_server->color().name();
IRCTab::m_notificationColor = m_notification->color().name();
IRCTab::m_maxLines = m_lines->text().toInt();
+ m_keyConf->save();
+
+
m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor);
m_config->writeEntry("TextColor", IRCTab::m_textColor);
m_config->writeEntry("ErrorColor", IRCTab::m_errorColor);
@@ -101,6 +117,8 @@ void IRCSettings::accept()
m_config->writeEntry("ServerColor", IRCTab::m_serverColor);
m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor);
m_config->writeEntry("Lines", m_lines->text());
+ IRCHistoryLineEdit::keyConfigInstance()->save();
+
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
@@ -27,6 +27,9 @@
namespace Opie {
class OColorButton;
+namespace Ui {
+class OKeyConfigWidget;
+}
}
class IRCSettings : public QDialog {
@@ -45,6 +48,7 @@ protected:
Opie::OColorButton *m_server;
Opie::OColorButton *m_other;
Opie::OColorButton *m_notification;
+ Opie::Ui::OKeyConfigWidget *m_keyConf;
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,8 +1,13 @@
+#include "irctab.h"
+#include "mainwindow.h"
+
+#include <opie2/okeyconfigmanager.h>
#include <qpe/resource.h>
+
+
#include <qpushbutton.h>
#include <qwhatsthis.h>
-#include "irctab.h"
-#include "mainwindow.h"
+
QString IRCTab::m_errorColor;
QString IRCTab::m_serverColor;
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
@@ -76,6 +76,7 @@ void MainWindow::changeEvent(IRCTab *tab) {
void MainWindow::killTab(IRCTab *tab) {
m_tabWidget->removePage(tab);
m_tabs.remove(tab);
+
/* there might be nicer ways to do this .. */
delete tab;
}