summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/inputmethods.cpp14
-rw-r--r--core/launcher/inputmethods.h2
-rw-r--r--core/launcher/taskbar.cpp41
-rw-r--r--core/launcher/taskbar.h30
-rw-r--r--core/settings/launcher/inputmethodsettings.cpp87
-rw-r--r--core/settings/launcher/inputmethodsettings.h57
-rw-r--r--core/settings/launcher/launcher.pro2
-rw-r--r--core/settings/launcher/launchersettings.cpp5
-rw-r--r--core/settings/launcher/launchersettings.h2
-rw-r--r--pics/launchersettings/inputmethod.pngbin0 -> 232 bytes
10 files changed, 200 insertions, 40 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index f0d8294..d89a366 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -7,164 +7,164 @@
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_LANGLIST 21#define QTOPIA_INTERNAL_LANGLIST
22#include "inputmethods.h" 22#include "inputmethods.h"
23 23
24#include <qtopia/config.h> 24#include <qtopia/config.h>
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26#include <qtopia/inputmethodinterface.h> 26#include <qtopia/inputmethodinterface.h>
27#include <qtopia/global.h> 27#include <qtopia/global.h>
28 28
29#include <qpopupmenu.h> 29#include <qpopupmenu.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qtoolbutton.h> 31#include <qtoolbutton.h>
32#include <qwidgetstack.h> 32#include <qwidgetstack.h>
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qdir.h> 36#include <qdir.h>
37#include <stdlib.h> 37#include <stdlib.h>
38#include <qtranslator.h> 38#include <qtranslator.h>
39#include <qtl.h> 39#include <qtl.h>
40 40
41#ifdef Q_WS_QWS 41#ifdef Q_WS_QWS
42#include <qwindowsystem_qws.h> 42#include <qwindowsystem_qws.h>
43#include <qwsevent_qws.h> 43#include <qwsevent_qws.h>
44#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
45#endif 45#endif
46 46
47/* ### SingleFloppy if someone is interested? */ 47/* ### SingleFloppy if someone is interested? */
48#if 0 48#if 0
49#ifdef QT_NO_COMPONENT 49#ifdef QT_NO_COMPONENT
50#include "../plugins/inputmethods/handwriting/handwritingimpl.h" 50#include "../plugins/inputmethods/handwriting/handwritingimpl.h"
51#include "../plugins/inputmethods/keyboard/keyboardimpl.h" 51#include "../plugins/inputmethods/keyboard/keyboardimpl.h"
52#include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h" 52#include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h"
53#endif 53#endif
54#endif 54#endif
55 55
56/* XPM */ 56/* XPM */
57static const char * tri_xpm[]={ 57static const char * tri_xpm[]={
58"9 9 2 1", 58"9 9 2 1",
59"a c #000000", 59"a c #000000",
60". c None", 60". c None",
61".........", 61".........",
62".........", 62".........",
63".........", 63".........",
64"....a....", 64"....a....",
65"...aaa...", 65"...aaa...",
66"..aaaaa..", 66"..aaaaa..",
67".aaaaaaa.", 67".aaaaaaa.",
68".........", 68".........",
69"........."}; 69"........."};
70 70
71static const int inputWidgetStyle = QWidget::WStyle_Customize |
72 QWidget::WStyle_Tool |
73 QWidget::WStyle_StaysOnTop |
74 QWidget::WGroupLeader;
75
76
77int InputMethod::operator <(const InputMethod& o) const 71int InputMethod::operator <(const InputMethod& o) const
78{ 72{
79 return name() < o.name(); 73 return name() < o.name();
80} 74}
81int InputMethod::operator >(const InputMethod& o) const 75int InputMethod::operator >(const InputMethod& o) const
82{ 76{
83 return name() > o.name(); 77 return name() > o.name();
84} 78}
85int InputMethod::operator <=(const InputMethod& o) const 79int InputMethod::operator <=(const InputMethod& o) const
86{ 80{
87 return name() <= o.name(); 81 return name() <= o.name();
88} 82}
89 83
90 84
91/* 85/*
92 Slightly hacky: We use WStyle_Tool as a flag to say "this widget 86 Slightly hacky: We use WStyle_Tool as a flag to say "this widget
93 belongs to the IM system, so clicking it should not cause a reset". 87 belongs to the IM system, so clicking it should not cause a reset".
94 */ 88 */
95class IMToolButton : public QToolButton 89class IMToolButton : public QToolButton
96{ 90{
97public: 91public:
98 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) 92 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent )
99 { setWFlags( WStyle_Tool ); } 93 { setWFlags( WStyle_Tool ); }
100}; 94};
101 95
102 96
103InputMethods::InputMethods( QWidget *parent ) : 97InputMethods::InputMethods( QWidget *parent ) :
104 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), 98 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ),
105 mkeyboard(0), imethod(0) 99 mkeyboard(0), imethod(0)
106{ 100{
101 Config cfg( "Launcher" );
102 cfg.setGroup( "InputMethods" );
103 inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader;
104 inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : QWidget::WStyle_Tool;
105 inputWidgetWidth = cfg.readNumEntry( "Width", 100 );
106
107 setBackgroundMode( PaletteBackground ); 107 setBackgroundMode( PaletteBackground );
108 QHBoxLayout *hbox = new QHBoxLayout( this ); 108 QHBoxLayout *hbox = new QHBoxLayout( this );
109 109
110 kbdButton = new IMToolButton( this); 110 kbdButton = new IMToolButton( this);
111 kbdButton->setFocusPolicy(NoFocus); 111 kbdButton->setFocusPolicy(NoFocus);
112 kbdButton->setToggleButton( TRUE ); 112 kbdButton->setToggleButton( TRUE );
113 if (parent->sizeHint().height() > 0) 113 if (parent->sizeHint().height() > 0)
114 kbdButton->setFixedHeight( parent->sizeHint().height() ); 114 kbdButton->setFixedHeight( parent->sizeHint().height() );
115 kbdButton->setFixedWidth( 32 ); 115 kbdButton->setFixedWidth( 32 );
116 kbdButton->setAutoRaise( TRUE ); 116 kbdButton->setAutoRaise( TRUE );
117 kbdButton->setUsesBigPixmap( TRUE ); 117 kbdButton->setUsesBigPixmap( TRUE );
118 hbox->addWidget( kbdButton ); 118 hbox->addWidget( kbdButton );
119 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); 119 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) );
120 120
121 kbdChoice = new IMToolButton( this ); 121 kbdChoice = new IMToolButton( this );
122 kbdChoice->setFocusPolicy(NoFocus); 122 kbdChoice->setFocusPolicy(NoFocus);
123 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 123 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
124 if (parent->sizeHint().height() > 0) 124 if (parent->sizeHint().height() > 0)
125 kbdChoice->setFixedHeight( parent->sizeHint().height() ); 125 kbdChoice->setFixedHeight( parent->sizeHint().height() );
126 kbdChoice->setFixedWidth( 13 ); 126 kbdChoice->setFixedWidth( 13 );
127 kbdChoice->setAutoRaise( TRUE ); 127 kbdChoice->setAutoRaise( TRUE );
128 hbox->addWidget( kbdChoice ); 128 hbox->addWidget( kbdChoice );
129 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); 129 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) );
130 130
131 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), 131 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()),
132 this, SLOT(resetStates()) ); 132 this, SLOT(resetStates()) );
133 133
134 134
135 imButton = new QWidgetStack( this ); // later a widget stack 135 imButton = new QWidgetStack( this ); // later a widget stack
136 imButton->setFocusPolicy(NoFocus); 136 imButton->setFocusPolicy(NoFocus);
137 if (parent->sizeHint().height() > 0) 137 if (parent->sizeHint().height() > 0)
138 imButton->setFixedHeight( parent->sizeHint().height() ); 138 imButton->setFixedHeight( parent->sizeHint().height() );
139 hbox->addWidget(imButton); 139 hbox->addWidget(imButton);
140 140
141 imChoice = new QToolButton( this ); 141 imChoice = new QToolButton( this );
142 imChoice->setFocusPolicy(NoFocus); 142 imChoice->setFocusPolicy(NoFocus);
143 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 143 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
144 if (parent->sizeHint().height() > 0) 144 if (parent->sizeHint().height() > 0)
145 imChoice->setFixedHeight( parent->sizeHint().height() ); 145 imChoice->setFixedHeight( parent->sizeHint().height() );
146 imChoice->setFixedWidth( 13 ); 146 imChoice->setFixedWidth( 13 );
147 imChoice->setAutoRaise( TRUE ); 147 imChoice->setAutoRaise( TRUE );
148 hbox->addWidget( imChoice ); 148 hbox->addWidget( imChoice );
149 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); 149 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) );
150 150
151 loadInputMethods(); 151 loadInputMethods();
152 152
153 QCopChannel *channel = new QCopChannel( "QPE/IME", this ); 153 QCopChannel *channel = new QCopChannel( "QPE/IME", this );
154 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 154 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
155 this, SLOT(qcopReceive(const QCString&, const QByteArray&)) ); 155 this, SLOT(qcopReceive(const QCString&, const QByteArray&)) );
156} 156}
157 157
158InputMethods::~InputMethods() 158InputMethods::~InputMethods()
159{ 159{
160 Config cfg("qpe"); 160 Config cfg("qpe");
161 cfg.setGroup("InputMethod"); 161 cfg.setGroup("InputMethod");
162 if (imethod) 162 if (imethod)
163 cfg.writeEntry("im", imethod->name() ); 163 cfg.writeEntry("im", imethod->name() );
164 if (mkeyboard) 164 if (mkeyboard)
165 cfg.writeEntry("current", mkeyboard->name() ); 165 cfg.writeEntry("current", mkeyboard->name() );
166 166
167 unloadInputMethods(); 167 unloadInputMethods();
168} 168}
169 169
170void InputMethods::hideInputMethod() 170void InputMethods::hideInputMethod()
@@ -476,91 +476,91 @@ void InputMethods::updateKeyboards(InputMethod *im )
476 } else { 476 } else {
477 count = inputMethodList.count(); 477 count = inputMethodList.count();
478 if ( count && !mkeyboard ) { 478 if ( count && !mkeyboard ) {
479 mkeyboard = &inputMethodList[0]; 479 mkeyboard = &inputMethodList[0];
480 kbdButton->setPixmap( *mkeyboard->icon() ); 480 kbdButton->setPixmap( *mkeyboard->icon() );
481 } else if (!count){ 481 } else if (!count){
482 mkeyboard = 0; //might be redundant 482 mkeyboard = 0; //might be redundant
483 } 483 }
484 } 484 }
485 485
486 if ( count > 1 ) 486 if ( count > 1 )
487 kbdChoice->show(); 487 kbdChoice->show();
488 else 488 else
489 kbdChoice->hide(); 489 kbdChoice->hide();
490 490
491 if ( count ) 491 if ( count )
492 kbdButton->show(); 492 kbdButton->show();
493 else 493 else
494 kbdButton->hide(); 494 kbdButton->hide();
495} 495}
496 496
497void InputMethods::chooseMethod(InputMethod* im) 497void InputMethods::chooseMethod(InputMethod* im)
498{ 498{
499 if ( im != imethod ) { 499 if ( im != imethod ) {
500 updateKeyboards( im ); 500 updateKeyboards( im );
501 501
502 Config cfg("qpe"); 502 Config cfg("qpe");
503 cfg.setGroup("InputMethod"); 503 cfg.setGroup("InputMethod");
504 if (im ) 504 if (im )
505 cfg.writeEntry("im", im->name() ); 505 cfg.writeEntry("im", im->name() );
506 if (mkeyboard) 506 if (mkeyboard)
507 cfg.writeEntry("current", mkeyboard->name() ); 507 cfg.writeEntry("current", mkeyboard->name() );
508 508
509 QWSServer::setCurrentInputMethod( 0 ); 509 QWSServer::setCurrentInputMethod( 0 );
510 imethod = im; 510 imethod = im;
511 if ( imethod && imethod->newIM ) 511 if ( imethod && imethod->newIM )
512 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); 512 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() );
513 else 513 else
514 QWSServer::setCurrentInputMethod( 0 ); 514 QWSServer::setCurrentInputMethod( 0 );
515 515
516 if ( im ) 516 if ( im )
517 imButton->raiseWidget(im->widget); 517 imButton->raiseWidget(im->widget);
518 else 518 else
519 imButton->hide(); //### good UI? make sure it is shown again! 519 imButton->hide(); //### good UI? make sure it is shown again!
520 } 520 }
521} 521}
522 522
523void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data ) 523void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data )
524{ 524{
525 if ( imethod && imethod->newIM ) 525 if ( imethod && imethod->newIM )
526 imethod->extInterface->qcopReceive( msg, data ); 526 imethod->extInterface->qcopReceive( msg, data );
527} 527}
528 528
529 529
530void InputMethods::showKbd( bool on ) 530void InputMethods::showKbd( bool on )
531{ 531{
532 if ( !mkeyboard ) 532 if ( !mkeyboard )
533 return; 533 return;
534 534
535 if ( on ) { 535 if ( on ) {
536 mkeyboard->resetState(); 536 mkeyboard->resetState();
537 // HACK... Make the texteditor fit with all input methods 537 // HACK... Make the texteditor fit with all input methods
538 // Input methods should also never use more than about 40% of the screen 538 // Input methods should also never use more than about 40% of the screen
539 int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); 539 int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 );
540 mkeyboard->widget->resize( qApp->desktop()->width(), height ); 540 mkeyboard->widget->resize( qApp->desktop()->width() * (inputWidgetWidth*0.01), height );
541 mkeyboard->widget->move( 0, mapToGlobal( QPoint() ).y() - height ); 541 mkeyboard->widget->move( 0, mapToGlobal( QPoint() ).y() - height );
542 mkeyboard->widget->show(); 542 mkeyboard->widget->show();
543 } else { 543 } else {
544 mkeyboard->widget->hide(); 544 mkeyboard->widget->hide();
545 } 545 }
546 546
547 emit inputToggled( on ); 547 emit inputToggled( on );
548} 548}
549 549
550bool InputMethods::shown() const 550bool InputMethods::shown() const
551{ 551{
552 return mkeyboard && mkeyboard->widget->isVisible(); 552 return mkeyboard && mkeyboard->widget->isVisible();
553} 553}
554 554
555QString InputMethods::currentShown() const 555QString InputMethods::currentShown() const
556{ 556{
557 return mkeyboard && mkeyboard->widget->isVisible() 557 return mkeyboard && mkeyboard->widget->isVisible()
558 ? mkeyboard->name() : QString::null; 558 ? mkeyboard->name() : QString::null;
559} 559}
560 560
561void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) 561void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat )
562{ 562{
563#if defined(Q_WS_QWS) 563#if defined(Q_WS_QWS)
564 QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); 564 QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat );
565#endif 565#endif
566} 566}
diff --git a/core/launcher/inputmethods.h b/core/launcher/inputmethods.h
index 93b69de..246661a 100644
--- a/core/launcher/inputmethods.h
+++ b/core/launcher/inputmethods.h
@@ -42,69 +42,71 @@ struct InputMethod
42 InputMethodInterface *interface; 42 InputMethodInterface *interface;
43 ExtInputMethodInterface *extInterface; 43 ExtInputMethodInterface *extInterface;
44 }; 44 };
45 45
46 inline void releaseInterface() { 46 inline void releaseInterface() {
47 newIM ? (void)extInterface->release() : (void)interface->release(); 47 newIM ? (void)extInterface->release() : (void)interface->release();
48 library->unload(); 48 library->unload();
49 delete library; library = 0l; 49 delete library; library = 0l;
50 } 50 }
51 inline QString name() const { return newIM ? extInterface->name() : interface->name(); } 51 inline QString name() const { return newIM ? extInterface->name() : interface->name(); }
52 inline QPixmap *icon() const { return newIM ? extInterface->icon() : interface->icon(); } 52 inline QPixmap *icon() const { return newIM ? extInterface->icon() : interface->icon(); }
53 inline QUnknownInterface *iface() { return newIM ? (QUnknownInterface *)extInterface : (QUnknownInterface *)interface; } 53 inline QUnknownInterface *iface() { return newIM ? (QUnknownInterface *)extInterface : (QUnknownInterface *)interface; }
54 inline void resetState() { if ( !newIM ) interface->resetState(); } 54 inline void resetState() { if ( !newIM ) interface->resetState(); }
55 55
56 int operator <(const InputMethod& o) const; 56 int operator <(const InputMethod& o) const;
57 int operator >(const InputMethod& o) const; 57 int operator >(const InputMethod& o) const;
58 int operator <=(const InputMethod& o) const; 58 int operator <=(const InputMethod& o) const;
59}; 59};
60 60
61class InputMethods : public QWidget 61class InputMethods : public QWidget
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 InputMethods( QWidget * ); 65 InputMethods( QWidget * );
66 ~InputMethods(); 66 ~InputMethods();
67 67
68 QRect inputRect() const; 68 QRect inputRect() const;
69 bool shown() const; 69 bool shown() const;
70 QString currentShown() const; // name of interface 70 QString currentShown() const; // name of interface
71 void showInputMethod(const QString& id); 71 void showInputMethod(const QString& id);
72 void showInputMethod(); 72 void showInputMethod();
73 void hideInputMethod(); 73 void hideInputMethod();
74 void unloadInputMethods(); 74 void unloadInputMethods();
75 void loadInputMethods(); 75 void loadInputMethods();
76 76
77signals: 77signals:
78 void inputToggled( bool on ); 78 void inputToggled( bool on );
79 79
80private slots: 80private slots:
81 void chooseKbd(); 81 void chooseKbd();
82 void chooseIm(); 82 void chooseIm();
83 void showKbd( bool ); 83 void showKbd( bool );
84 void resetStates(); 84 void resetStates();
85 void sendKey( ushort unicode, ushort scancode, ushort modifiers, bool, bool ); 85 void sendKey( ushort unicode, ushort scancode, ushort modifiers, bool, bool );
86 void qcopReceive( const QCString &msg, const QByteArray &data ); 86 void qcopReceive( const QCString &msg, const QByteArray &data );
87 87
88private: 88private:
89 void setPreferedHandlers(); 89 void setPreferedHandlers();
90 /*static */QStringList plugins()const; 90 /*static */QStringList plugins()const;
91 /*static */void installTranslator( const QString& ); 91 /*static */void installTranslator( const QString& );
92 void unloadMethod( QValueList<InputMethod>& ); 92 void unloadMethod( QValueList<InputMethod>& );
93 void chooseMethod(InputMethod* im); 93 void chooseMethod(InputMethod* im);
94 void chooseKeyboard(InputMethod* im); 94 void chooseKeyboard(InputMethod* im);
95 void updateKeyboards(InputMethod *im); 95 void updateKeyboards(InputMethod *im);
96 96
97private: 97private:
98 QToolButton *kbdButton; 98 QToolButton *kbdButton;
99 QToolButton *kbdChoice; 99 QToolButton *kbdChoice;
100 QWidgetStack *imButton; // later will be widget stack 100 QWidgetStack *imButton; // later will be widget stack
101 QToolButton *imChoice; 101 QToolButton *imChoice;
102 InputMethod *mkeyboard; 102 InputMethod *mkeyboard;
103 InputMethod *imethod; 103 InputMethod *imethod;
104 QValueList<InputMethod> inputMethodList; 104 QValueList<InputMethod> inputMethodList;
105 QValueList<InputMethod> inputModifierList; 105 QValueList<InputMethod> inputModifierList;
106 int inputWidgetStyle;
107 int inputWidgetWidth;
106}; 108};
107 109
108 110
109#endif // __INPUT_METHODS_H__ 111#endif // __INPUT_METHODS_H__
110 112
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 37fdb30..2966168 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,94 +1,95 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "startmenu.h" 21#include "startmenu.h"
22#include "inputmethods.h" 22#include "inputmethods.h"
23#include "runningappbar.h" 23#include "runningappbar.h"
24#include "systray.h" 24#include "systray.h"
25#include "wait.h" 25#include "wait.h"
26#include "appicons.h" 26#include "appicons.h"
27 27
28#include "taskbar.h" 28#include "taskbar.h"
29#include "server.h" 29#include "server.h"
30 30
31#include <qtopia/config.h>
31#include <qtopia/qpeapplication.h> 32#include <qtopia/qpeapplication.h>
32#ifdef QWS 33#ifdef QWS
33#include <qtopia/qcopenvelope_qws.h> 34#include <qtopia/qcopenvelope_qws.h>
34#endif 35#endif
35#include <qtopia/global.h> 36#include <qtopia/global.h>
36#include <qtopia/custom.h> 37#include <qtopia/custom.h>
37 38
38#include <qlabel.h> 39#include <qlabel.h>
39#include <qlayout.h> 40#include <qlayout.h>
40#include <qtimer.h> 41#include <qtimer.h>
41#ifdef QWS 42#ifdef QWS
42#include <qwindowsystem_qws.h> 43#include <qwindowsystem_qws.h>
43#endif 44#endif
44#include <qwidgetstack.h> 45#include <qwidgetstack.h>
45 46
46#if defined( Q_WS_QWS ) 47#if defined( Q_WS_QWS )
47#include <qwsdisplay_qws.h> 48#include <qwsdisplay_qws.h>
48#include <qgfx_qws.h> 49#include <qgfx_qws.h>
49#endif 50#endif
50 51
51 52
52static bool initNumLock() 53static bool initNumLock()
53{ 54{
54#ifdef QPE_INITIAL_NUMLOCK_STATE 55#ifdef QPE_INITIAL_NUMLOCK_STATE
55 QPE_INITIAL_NUMLOCK_STATE 56 QPE_INITIAL_NUMLOCK_STATE
56#endif 57#endif
57 return FALSE; 58 return FALSE;
58} 59}
59 60
60//--------------------------------------------------------------------------- 61//---------------------------------------------------------------------------
61 62
62class SafeMode : public QWidget 63class SafeMode : public QWidget
63{ 64{
64 Q_OBJECT 65 Q_OBJECT
65public: 66public:
66 SafeMode( QWidget *parent ) : QWidget( parent ), menu(0) 67 SafeMode( QWidget *parent ) : QWidget( parent ), menu(0)
67 { 68 {
68 message = tr("Safe Mode"); 69 message = tr("Safe Mode");
69 QFont f( font() ); 70 QFont f( font() );
70 f.setWeight( QFont::Bold ); 71 f.setWeight( QFont::Bold );
71 setFont( f ); 72 setFont( f );
72 } 73 }
73 74
74 void mousePressEvent( QMouseEvent *); 75 void mousePressEvent( QMouseEvent *);
75 QSize sizeHint() const; 76 QSize sizeHint() const;
76 void paintEvent( QPaintEvent* ); 77 void paintEvent( QPaintEvent* );
77 78
78private slots: 79private slots:
79 void action(int i); 80 void action(int i);
80 81
81private: 82private:
82 QString message; 83 QString message;
83 QPopupMenu *menu; 84 QPopupMenu *menu;
84}; 85};
85 86
86void SafeMode::mousePressEvent( QMouseEvent *) 87void SafeMode::mousePressEvent( QMouseEvent *)
87{ 88{
88 if ( !menu ) { 89 if ( !menu ) {
89 menu = new QPopupMenu(this); 90 menu = new QPopupMenu(this);
90 menu->insertItem( tr("Plugin Manager..."), 0 ); 91 menu->insertItem( tr("Plugin Manager..."), 0 );
91 menu->insertItem( tr("Restart Qtopia"), 1 ); 92 menu->insertItem( tr("Restart Qtopia"), 1 );
92 menu->insertItem( tr("Help..."), 2 ); 93 menu->insertItem( tr("Help..."), 2 );
93 connect(menu, SIGNAL(activated(int)), this, SLOT(action(int))); 94 connect(menu, SIGNAL(activated(int)), this, SLOT(action(int)));
94 } 95 }
@@ -111,264 +112,266 @@ void SafeMode::action(int i)
111 break; 112 break;
112 } 113 }
113} 114}
114 115
115QSize SafeMode::sizeHint() const 116QSize SafeMode::sizeHint() const
116{ 117{
117 QFontMetrics fm = fontMetrics(); 118 QFontMetrics fm = fontMetrics();
118 119
119 return QSize( fm.width(message), fm.height() ); 120 return QSize( fm.width(message), fm.height() );
120} 121}
121 122
122void SafeMode::paintEvent( QPaintEvent* ) 123void SafeMode::paintEvent( QPaintEvent* )
123{ 124{
124 QPainter p(this); 125 QPainter p(this);
125 p.drawText( rect(), AlignCenter, message ); 126 p.drawText( rect(), AlignCenter, message );
126} 127}
127 128
128//--------------------------------------------------------------------------- 129//---------------------------------------------------------------------------
129 130
130class LockKeyState : public QWidget 131class LockKeyState : public QWidget
131{ 132{
132public: 133public:
133 LockKeyState( QWidget *parent ) : 134 LockKeyState( QWidget *parent ) :
134 QWidget(parent), 135 QWidget(parent),
135 nl(initNumLock()), cl(FALSE) 136 nl(initNumLock()), cl(FALSE)
136 { 137 {
137 nl_pm = Resource::loadPixmap("numlock"); 138 nl_pm = Resource::loadPixmap("numlock");
138 cl_pm = Resource::loadPixmap("capslock"); 139 cl_pm = Resource::loadPixmap("capslock");
139 } 140 }
140 QSize sizeHint() const 141 QSize sizeHint() const
141 { 142 {
142 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 143 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
143 } 144 }
144 void toggleNumLockState() 145 void toggleNumLockState()
145 { 146 {
146 nl = !nl; repaint(); 147 nl = !nl; repaint();
147 } 148 }
148 void toggleCapsLockState() 149 void toggleCapsLockState()
149 { 150 {
150 cl = !cl; repaint(); 151 cl = !cl; repaint();
151 } 152 }
152 void paintEvent( QPaintEvent * ) 153 void paintEvent( QPaintEvent * )
153 { 154 {
154 int y = (height()-sizeHint().height())/2; 155 int y = (height()-sizeHint().height())/2;
155 QPainter p(this); 156 QPainter p(this);
156 if ( nl ) 157 if ( nl )
157 p.drawPixmap(1,y,nl_pm); 158 p.drawPixmap(1,y,nl_pm);
158 if ( cl ) 159 if ( cl )
159 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 160 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
160 } 161 }
161private: 162private:
162 QPixmap nl_pm, cl_pm; 163 QPixmap nl_pm, cl_pm;
163 bool nl, cl; 164 bool nl, cl;
164}; 165};
165 166
166//--------------------------------------------------------------------------- 167//---------------------------------------------------------------------------
167 168
168TaskBar::~TaskBar() 169TaskBar::~TaskBar()
169{ 170{
170} 171}
171 172
172 173
173TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 174TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
174{ 175{
176 Config cfg( "Launcher" );
177 cfg.setGroup( "InputMethods" );
178 resizeRunningApp = cfg.readBoolEntry( "Resize", true );
179
175 sm = new StartMenu( this ); 180 sm = new StartMenu( this );
176 connect( sm, SIGNAL(tabSelected(const QString&)), this, 181 connect( sm, SIGNAL(tabSelected(const QString&)), this,
177 SIGNAL(tabSelected(const QString&)) ); 182 SIGNAL(tabSelected(const QString&)) );
178 183
179 inputMethods = new InputMethods( this ); 184 inputMethods = new InputMethods( this );
180 connect( inputMethods, SIGNAL(inputToggled(bool)), 185 connect( inputMethods, SIGNAL(inputToggled(bool)),
181 this, SLOT(calcMaxWindowRect()) ); 186 this, SLOT(calcMaxWindowRect()) );
182 187
183 stack = new QWidgetStack( this ); 188 stack = new QWidgetStack( this );
184 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 189 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
185 label = new QLabel(stack); 190 label = new QLabel(stack);
186 191
187 runningAppBar = new RunningAppBar(stack); 192 runningAppBar = new RunningAppBar(stack);
188 stack->raiseWidget(runningAppBar); 193 stack->raiseWidget(runningAppBar);
189 194
190 waitIcon = new Wait( this ); 195 waitIcon = new Wait( this );
191 (void) new AppIcons( this ); 196 (void) new AppIcons( this );
192 197
193 sysTray = new SysTray( this ); 198 sysTray = new SysTray( this );
194 199
195 /* ### FIXME plugin loader and safe mode */ 200 /* ### FIXME plugin loader and safe mode */
196#if 0 201#if 0
197 if (PluginLoader::inSafeMode()) 202 if (PluginLoader::inSafeMode())
198 (void)new SafeMode( this ); 203 (void)new SafeMode( this );
199#endif 204#endif
200 205
201 // ## make customizable in some way? 206 // ## make customizable in some way?
202#ifdef QT_QWS_CUSTOM 207#ifdef QT_QWS_CUSTOM
203 lockState = new LockKeyState( this ); 208 lockState = new LockKeyState( this );
204#else 209#else
205 lockState = 0; 210 lockState = 0;
206#endif 211#endif
207 212
208#if defined(Q_WS_QWS) 213#if defined(Q_WS_QWS)
209#if !defined(QT_NO_COP) 214#if !defined(QT_NO_COP)
210 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 215 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
211 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 216 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
212 this, SLOT(receive(const QCString&, const QByteArray&)) ); 217 this, SLOT(receive(const QCString&, const QByteArray&)) );
213#endif 218#endif
214#endif 219#endif
215 waitTimer = new QTimer( this ); 220 waitTimer = new QTimer( this );
216 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 221 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
217 clearer = new QTimer( this ); 222 clearer = new QTimer( this );
218 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 223 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
219 224
220 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); 225 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) );
221 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); 226 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) );
222 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); 227 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) );
223} 228}
224 229
225void TaskBar::setStatusMessage( const QString &text ) 230void TaskBar::setStatusMessage( const QString &text )
226{ 231{
227 if ( !text.isEmpty() ) { 232 if ( !text.isEmpty() ) {
228 label->setText( text ); 233 label->setText( text );
229 stack->raiseWidget( label ); 234 stack->raiseWidget( label );
230 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 235 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
231 sysTray->hide(); 236 sysTray->hide();
232 clearer->start( 3000, TRUE ); 237 clearer->start( 3000, TRUE );
233 } else { 238 } else {
234 clearStatusBar(); 239 clearStatusBar();
235 } 240 }
236} 241}
237 242
238void TaskBar::clearStatusBar() 243void TaskBar::clearStatusBar()
239{ 244{
240 label->clear(); 245 label->clear();
241 stack->raiseWidget(runningAppBar); 246 stack->raiseWidget(runningAppBar);
242 if ( sysTray ) 247 if ( sysTray )
243 sysTray->show(); 248 sysTray->show();
244 // stack->raiseWidget( mru ); 249 // stack->raiseWidget( mru );
245} 250}
246 251
247void TaskBar::startWait() 252void TaskBar::startWait()
248{ 253{
249 waitIcon->setWaiting( true ); 254 waitIcon->setWaiting( true );
250 // a catchall stop after 10 seconds... 255 // a catchall stop after 10 seconds...
251 waitTimer->start( 10 * 1000, true ); 256 waitTimer->start( 10 * 1000, true );
252} 257}
253 258
254void TaskBar::stopWait(const QString&) 259void TaskBar::stopWait(const QString&)
255{ 260{
256 waitTimer->stop(); 261 waitTimer->stop();
257 waitIcon->setWaiting( false ); 262 waitIcon->setWaiting( false );
258} 263}
259 264
260void TaskBar::stopWait() 265void TaskBar::stopWait()
261{ 266{
262 waitTimer->stop(); 267 waitTimer->stop();
263 waitIcon->setWaiting( false ); 268 waitIcon->setWaiting( false );
264} 269}
265 270
266/* 271/*
267 * This resizeEvent will be captured by 272 * This resizeEvent will be captured by
268 * the ServerInterface and it'll layout 273 * the ServerInterface and it'll layout
269 * and calc rect. Now if we go from bigger 274 * and calc rect. Now if we go from bigger
270 * to smaller screen the SysTray is out of 275 * to smaller screen the SysTray is out of
271 * bounds and repaint() won't trigger an Event 276 * bounds and repaint() won't trigger an Event
272 */ 277 */
273void TaskBar::resizeEvent( QResizeEvent *e ) 278void TaskBar::resizeEvent( QResizeEvent *e )
274{ 279{
275 if ( sysTray ) 280 if ( sysTray )
276 sysTray->hide(); 281 sysTray->hide();
277 282
278 QHBox::resizeEvent( e ); 283 QHBox::resizeEvent( e );
279 284
280 if ( sysTray ) 285 if ( sysTray )
281 sysTray->show(); 286 sysTray->show();
282 287
283 qWarning("TaskBar::resize event"); 288 qWarning("TaskBar::resize event");
284} 289}
285 290
286void TaskBar::styleChange( QStyle &s ) 291void TaskBar::styleChange( QStyle &s )
287{ 292{
288 QHBox::styleChange( s ); 293 QHBox::styleChange( s );
289 calcMaxWindowRect(); 294 calcMaxWindowRect();
290} 295}
291 296
292void TaskBar::calcMaxWindowRect() 297void TaskBar::calcMaxWindowRect()
293{ 298{
294 /* 299 if ( resizeRunningApp )
295#ifdef Q_WS_QWS 300 {
296 QRect wr; 301 #if defined(Q_WS_QWS)
297 int displayWidth = qApp->desktop()->width(); 302 QRect wr;
298 QRect ir = inputMethods->inputRect(); 303 int displayWidth = qApp->desktop()->width();
299 if ( ir.isValid() ) { 304 QRect ir = inputMethods->inputRect();
300 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 305 if ( ir.isValid() ) {
301 } else { 306 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
302 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 307 } else {
308 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
309 }
310 #if QT_VERSION < 0x030000
311 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,QSize(qt_screen->width(),qt_screen->height())) );
312 #else
313 QWSServer::setMaxWindowRect( wr );
314 #endif
315 #endif
303 } 316 }
304
305#if QT_VERSION < 0x030000
306 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
307 QSize(qt_screen->width(),qt_screen->height()))
308 );
309#else
310 QWSServer::setMaxWindowRect( wr );
311#endif
312#endif
313 */
314} 317}
315 318
316void TaskBar::receive( const QCString &msg, const QByteArray &data ) 319void TaskBar::receive( const QCString &msg, const QByteArray &data )
317{ 320{
318 QDataStream stream( data, IO_ReadOnly ); 321 QDataStream stream( data, IO_ReadOnly );
319 if ( msg == "message(QString)" ) { 322 if ( msg == "message(QString)" ) {
320 QString text; 323 QString text;
321 stream >> text; 324 stream >> text;
322 setStatusMessage( text ); 325 setStatusMessage( text );
323 } else if ( msg == "hideInputMethod()" ) { 326 } else if ( msg == "hideInputMethod()" ) {
324 inputMethods->hideInputMethod(); 327 inputMethods->hideInputMethod();
325 } else if ( msg == "showInputMethod()" ) { 328 } else if ( msg == "showInputMethod()" ) {
326 inputMethods->showInputMethod(); 329 inputMethods->showInputMethod();
327 } else if ( msg == "showInputMethod(QString)" ) { 330 } else if ( msg == "showInputMethod(QString)" ) {
328 QString name; 331 QString name;
329 stream >> name; 332 stream >> name;
330 inputMethods->showInputMethod(name); 333 inputMethods->showInputMethod(name);
331 } else if ( msg == "reloadInputMethods()" ) { 334 } else if ( msg == "reloadInputMethods()" ) {
332 inputMethods->loadInputMethods(); 335 inputMethods->loadInputMethods();
333 } else if ( msg == "reloadApplets()" ) { 336 } else if ( msg == "reloadApplets()" ) {
334 sysTray->clearApplets(); 337 sysTray->clearApplets();
335 sm->createMenu(); 338 sm->createMenu();
336 sysTray->addApplets(); 339 sysTray->addApplets();
337 }else if ( msg == "toggleMenu()" ) { 340 }else if ( msg == "toggleMenu()" ) {
338 if ( sm-> launchMenu-> isVisible() ) 341 if ( sm-> launchMenu-> isVisible() )
339 sm-> launch(); 342 sm-> launch();
340 else 343 else
341 QCopEnvelope e( "QPE/System", "toggleApplicationMenu()" ); 344 QCopEnvelope e( "QPE/System", "toggleApplicationMenu()" );
342 }else if ( msg == "toggleStartMenu()" ) 345 }else if ( msg == "toggleStartMenu()" )
343 sm->launch(); 346 sm->launch();
344} 347}
345 348
346void TaskBar::setApplicationState( const QString &name, ServerInterface::ApplicationState state ) 349void TaskBar::setApplicationState( const QString &name, ServerInterface::ApplicationState state )
347{ 350{
348 if ( state == ServerInterface::Launching ) 351 if ( state == ServerInterface::Launching )
349 runningAppBar->applicationLaunched( name ); 352 runningAppBar->applicationLaunched( name );
350 else if ( state == ServerInterface::Terminated ) 353 else if ( state == ServerInterface::Terminated )
351 runningAppBar->applicationTerminated( name ); 354 runningAppBar->applicationTerminated( name );
352} 355}
353 356
354void TaskBar::toggleNumLockState() 357void TaskBar::toggleNumLockState()
355{ 358{
356 if ( lockState ) lockState->toggleNumLockState(); 359 if ( lockState ) lockState->toggleNumLockState();
357} 360}
358 361
359void TaskBar::toggleCapsLockState() 362void TaskBar::toggleCapsLockState()
360{ 363{
361 if ( lockState ) lockState->toggleCapsLockState(); 364 if ( lockState ) lockState->toggleCapsLockState();
362} 365}
363 366
364void TaskBar::toggleSymbolInput() 367void TaskBar::toggleSymbolInput()
365{ 368{
366 QString unicodeInput = qApp->translate( "InputMethods", "Unicode" ); 369 QString unicodeInput = qApp->translate( "InputMethods", "Unicode" );
367 if ( inputMethods->currentShown() == unicodeInput ) { 370 if ( inputMethods->currentShown() == unicodeInput ) {
368 inputMethods->hideInputMethod(); 371 inputMethods->hideInputMethod();
369 } else { 372 } else {
370 inputMethods->showInputMethod( unicodeInput ); 373 inputMethods->showInputMethod( unicodeInput );
371 } 374 }
372} 375}
373 376
374#include "taskbar.moc" 377#include "taskbar.moc"
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index 0cfc123..ed558b1 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -1,83 +1,87 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef __TASKBAR_H__ 21#ifndef TASKBAR_H
22#define __TASKBAR_H__ 22#define TASKBAR_H
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25#include "serverinterface.h"
26#include "startmenu.h"
25 27
26class QLabel; 28class QLabel;
27class QTimer; 29class QTimer;
28class InputMethods; 30class InputMethods;
29class Wait; 31class Wait;
30class SysTray; 32class SysTray;
31class RunningAppBar; 33class RunningAppBar;
32class QWidgetStack; 34class QWidgetStack;
33class QTimer; 35class QTimer;
34class QLabel; 36class QLabel;
35class StartMenu;
36class LockKeyState; 37class LockKeyState;
38class AppLnkSet;
37 39
38class TaskBar : public QHBox { 40class TaskBar : public QHBox {
39 Q_OBJECT 41 Q_OBJECT
40public: 42public:
41 TaskBar(); 43 TaskBar();
42 ~TaskBar(); 44 ~TaskBar();
43 45
44 static QWidget *calibrate( bool ); 46 void launchStartMenu() { if (sm) sm->launch(); }
47 void refreshStartMenu() { if (sm) sm->refreshMenu(); }
48 void setApplicationState( const QString &name, ServerInterface::ApplicationState state );
45 49
46 bool recoverMemory(); 50signals:
51 void tabSelected(const QString&);
47 52
48 StartMenu *startMenu() const { return sm; }
49public slots: 53public slots:
50 void startWait(); 54 void startWait();
51 void stopWait(const QString&); 55 void stopWait(const QString&);
52 void stopWait(); 56 void stopWait();
57
53 void clearStatusBar(); 58 void clearStatusBar();
54 void toggleNumLockState(); 59 void toggleNumLockState();
55 void toggleCapsLockState(); 60 void toggleCapsLockState();
56 void toggleSymbolInput(); 61 void toggleSymbolInput();
62 void calcMaxWindowRect();
57 63
58protected: 64protected:
59 void resizeEvent( QResizeEvent * ); 65 void resizeEvent( QResizeEvent * );
60 void styleChange( QStyle & ); 66 void styleChange( QStyle & );
61 void setStatusMessage( const QString &text ); 67 void setStatusMessage( const QString &text );
62 68
63public slots:
64 void calcMaxWindowRect();
65private slots: 69private slots:
66 void receive( const QCString &msg, const QByteArray &data ); 70 void receive( const QCString &msg, const QByteArray &data );
67 71
68private: 72private:
69
70 QTimer *waitTimer; 73 QTimer *waitTimer;
71 Wait *waitIcon; 74 Wait *waitIcon;
72 InputMethods *inputMethods; 75 InputMethods *inputMethods;
73 SysTray *sysTray; 76 SysTray *sysTray;
74 RunningAppBar* runningAppBar; 77 RunningAppBar* runningAppBar;
75 QWidgetStack *stack; 78 QWidgetStack *stack;
76 QTimer *clearer; 79 QTimer *clearer;
77 QLabel *label; 80 QLabel *label;
78 LockKeyState* lockState; 81 LockKeyState* lockState;
79 StartMenu *sm; 82 StartMenu *sm;
83 bool resizeRunningApp;
80}; 84};
81 85
82 86
83#endif // __TASKBAR_H__ 87#endif // TASKBAR_H
diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp
new file mode 100644
index 0000000..1aa1ae8
--- a/dev/null
+++ b/core/settings/launcher/inputmethodsettings.cpp
@@ -0,0 +1,87 @@
1/*
2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org>
5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29#include "inputmethodsettings.h"
30
31#include <qpe/config.h>
32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h>
34
35#include <qspinbox.h>
36#include <qcheckbox.h>
37#include <qlayout.h>
38#include <qlabel.h>
39#include <qwhatsthis.h>
40
41InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name )
42{
43 QBoxLayout *lay = new QVBoxLayout( this, 4, 4 );
44
45 _resize = new QCheckBox( tr( "Resize application on Popup" ), this );
46 _float = new QCheckBox( tr( "Enable floating and resizing" ), this );
47
48 QHBoxLayout* hbox = new QHBoxLayout( this, 4, 4 );
49 hbox->addWidget( new QLabel( "Initial Width:", this ) );
50 _size = new QSpinBox( 10, 100, 10, this );
51 _size->setSuffix( "%" );
52 hbox->addWidget( _size );
53 hbox->addStretch();
54
55 Config cfg( "Launcher" );
56 cfg.setGroup( "InputMethods" );
57 _resize->setChecked( cfg.readBoolEntry( "Resize", true ) );
58 _float->setChecked( cfg.readBoolEntry( "Float", false ) );
59 _size->setValue( cfg.readNumEntry( "Width", 100 ) );
60
61 lay->addWidget( _resize );
62 lay->addWidget( _float );
63 lay->addLayout( hbox );
64 lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) );
65
66 lay->addStretch();
67
68 QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) );
69 QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) );
70 QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) );
71}
72
73void InputMethodSettings::appletChanged()
74{
75}
76
77void InputMethodSettings::accept()
78{
79 qDebug( "InputMethodSettings::accept()" );
80 Config cfg( "Launcher" );
81 cfg.setGroup( "InputMethods" );
82 cfg.writeEntry( "Resize", _resize->isChecked() );
83 cfg.writeEntry( "Float", _float->isChecked() );
84 cfg.writeEntry( "Width", _size->value() );
85 cfg.write();
86}
87
diff --git a/core/settings/launcher/inputmethodsettings.h b/core/settings/launcher/inputmethodsettings.h
new file mode 100644
index 0000000..486ee5e
--- a/dev/null
+++ b/core/settings/launcher/inputmethodsettings.h
@@ -0,0 +1,57 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA.
25
26*/
27
28#ifndef __IMETHOD_SETTINGS_H__
29#define __IMETHOD_SETTINGS_H__
30
31#include <qwidget.h>
32
33class QCheckBox;
34class QSpinBox;
35
36class InputMethodSettings : public QWidget
37{
38 Q_OBJECT
39
40 public:
41 InputMethodSettings ( QWidget *parent = 0, const char *name = 0 );
42
43 void accept ( );
44
45 protected slots:
46 void appletChanged ( );
47
48 protected:
49 void init ( );
50
51 private:
52 QCheckBox* _resize;
53 QCheckBox* _float;
54 QSpinBox* _size;
55};
56
57#endif
diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro
index e532852..cea268d 100644
--- a/core/settings/launcher/launcher.pro
+++ b/core/settings/launcher/launcher.pro
@@ -1,26 +1,28 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = launchersettings.h \ 4HEADERS = launchersettings.h \
5 tabssettings.h \ 5 tabssettings.h \
6 taskbarsettings.h \ 6 taskbarsettings.h \
7 menusettings.h \ 7 menusettings.h \
8 inputmethodsettings.h \
8 tabconfig.h \ 9 tabconfig.h \
9 tabdialog.h 10 tabdialog.h
10 11
11SOURCES = main.cpp \ 12SOURCES = main.cpp \
12 launchersettings.cpp \ 13 launchersettings.cpp \
13 tabssettings.cpp \ 14 tabssettings.cpp \
14 taskbarsettings.cpp \ 15 taskbarsettings.cpp \
15 menusettings.cpp \ 16 menusettings.cpp \
17 inputmethodsettings.cpp \
16 tabdialog.cpp 18 tabdialog.cpp
17 19
18INCLUDEPATH += $(OPIEDIR)/include 20INCLUDEPATH += $(OPIEDIR)/include
19DEPENDPATH += $(OPIEDIR)/include 21DEPENDPATH += $(OPIEDIR)/include
20LIBS += -lqpe -lopie 22LIBS += -lqpe -lopie
21TARGET = launchersettings 23TARGET = launchersettings
22 24
23 25
24 26
25 27
26include ( $(OPIEDIR)/include.pro ) 28include ( $(OPIEDIR)/include.pro )
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp
index cb6e98a..3982194 100644
--- a/core/settings/launcher/launchersettings.cpp
+++ b/core/settings/launcher/launchersettings.cpp
@@ -1,73 +1,76 @@
1 1
2/* 2/*
3               =. This file is part of the OPIE Project 3               =. This file is part of the OPIE Project
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <opie/otabwidget.h> 32#include <opie/otabwidget.h>
33 33
34#include "launchersettings.h" 34#include "launchersettings.h"
35#include "tabssettings.h" 35#include "tabssettings.h"
36#include "menusettings.h" 36#include "menusettings.h"
37#include "taskbarsettings.h" 37#include "taskbarsettings.h"
38 38#include "inputmethodsettings.h"
39 39
40LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) 40LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp )
41{ 41{
42 setCaption ( tr( "Launcher Settings" )); 42 setCaption ( tr( "Launcher Settings" ));
43 43
44 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 44 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
45 45
46 OTabWidget *tw = new OTabWidget ( this, "otab" ); 46 OTabWidget *tw = new OTabWidget ( this, "otab" );
47 lay-> addWidget ( tw ); 47 lay-> addWidget ( tw );
48 48
49 m_tabs = new TabsSettings ( tw ); 49 m_tabs = new TabsSettings ( tw );
50 m_taskbar = new TaskbarSettings ( tw ); 50 m_taskbar = new TaskbarSettings ( tw );
51 m_menu = new MenuSettings ( tw ); 51 m_menu = new MenuSettings ( tw );
52 m_imethods = new InputMethodSettings ( tw );
52 53
53 tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); 54 tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" ));
54 tw-> addTab ( m_menu, "go", tr( "O-Menu" )); 55 tw-> addTab ( m_menu, "go", tr( "O-Menu" ));
55 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); 56 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" ));
57 tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" ));
56 58
57 tw-> setCurrentTab ( m_taskbar ); 59 tw-> setCurrentTab ( m_taskbar );
58} 60}
59 61
60void LauncherSettings::accept ( ) 62void LauncherSettings::accept ( )
61{ 63{
62 m_taskbar-> accept ( ); 64 m_taskbar-> accept ( );
63 m_menu-> accept ( ); 65 m_menu-> accept ( );
64 m_tabs-> accept ( ); 66 m_tabs-> accept ( );
67 m_imethods-> accept ( );
65 68
66 QDialog::accept ( ); 69 QDialog::accept ( );
67} 70}
68 71
69void LauncherSettings::done ( int r ) 72void LauncherSettings::done ( int r )
70{ 73{
71 QDialog::done ( r ); 74 QDialog::done ( r );
72 close ( ); 75 close ( );
73} 76}
diff --git a/core/settings/launcher/launchersettings.h b/core/settings/launcher/launchersettings.h
index 56c916e..71165a3 100644
--- a/core/settings/launcher/launchersettings.h
+++ b/core/settings/launcher/launchersettings.h
@@ -1,52 +1,54 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#ifndef __LAUNCHER_SETTINGS_H__ 28#ifndef __LAUNCHER_SETTINGS_H__
29#define __LAUNCHER_SETTINGS_H__ 29#define __LAUNCHER_SETTINGS_H__
30 30
31#include <qdialog.h> 31#include <qdialog.h>
32 32
33class TabsSettings; 33class TabsSettings;
34class TaskbarSettings; 34class TaskbarSettings;
35class MenuSettings; 35class MenuSettings;
36class InputMethodSettings;
36 37
37class LauncherSettings : public QDialog { 38class LauncherSettings : public QDialog {
38 Q_OBJECT 39 Q_OBJECT
39 40
40public: 41public:
41 LauncherSettings ( ); 42 LauncherSettings ( );
42 43
43 virtual void accept ( ); 44 virtual void accept ( );
44 virtual void done ( int r ); 45 virtual void done ( int r );
45 46
46private: 47private:
47 TabsSettings *m_tabs; 48 TabsSettings *m_tabs;
48 TaskbarSettings *m_taskbar; 49 TaskbarSettings *m_taskbar;
49 MenuSettings *m_menu; 50 MenuSettings *m_menu;
51 InputMethodSettings* m_imethods;
50}; 52};
51 53
52#endif 54#endif
diff --git a/pics/launchersettings/inputmethod.png b/pics/launchersettings/inputmethod.png
new file mode 100644
index 0000000..f5af6cb
--- a/dev/null
+++ b/pics/launchersettings/inputmethod.png
Binary files differ