-rw-r--r-- | libopie2/opieui/big-screen/obigscreen_p.h | 2 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/osplitter.cpp | 6 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/osplitter.h | 6 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 5 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.h | 12 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector_p.h | 2 | ||||
-rw-r--r-- | libopie2/opieui/ofontselector.cpp | 4 | ||||
-rw-r--r-- | libopie2/opieui/ofontselector.h | 4 | ||||
-rw-r--r-- | libopie2/opieui/okeyconfigwidget.cpp | 41 | ||||
-rw-r--r-- | libopie2/opieui/okeyconfigwidget.h | 8 | ||||
-rw-r--r-- | libopie2/opieui/okeyconfigwidget_p.h | 2 | ||||
-rw-r--r-- | libopie2/opieui/otaskbarapplet.h | 4 |
12 files changed, 49 insertions, 47 deletions
diff --git a/libopie2/opieui/big-screen/obigscreen_p.h b/libopie2/opieui/big-screen/obigscreen_p.h index a85a56c..baa2bbc 100644 --- a/libopie2/opieui/big-screen/obigscreen_p.h +++ b/libopie2/opieui/big-screen/obigscreen_p.h | |||
@@ -1,31 +1,31 @@ | |||
1 | #ifndef OPIE_BIG_SCREEN_PRIVATE | 1 | #ifndef OPIE_BIG_SCREEN_PRIVATE |
2 | #define OPIE_BIG_SCREEN_PRIVATE | 2 | #define OPIE_BIG_SCREEN_PRIVATE |
3 | 3 | ||
4 | /* QT */ | 4 | /* QT */ |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | class QWidget; | 7 | class QWidget; |
8 | 8 | ||
9 | namespace Opie { | 9 | namespace Opie { |
10 | namespace Ui { | 10 | namespace Ui { |
11 | namespace Private{ | 11 | namespace Internal{ |
12 | 12 | ||
13 | struct OSplitterContainer | 13 | struct OSplitterContainer |
14 | { | 14 | { |
15 | bool operator==( const OSplitterContainer& o) const | 15 | bool operator==( const OSplitterContainer& o) const |
16 | { | 16 | { |
17 | if (widget != o.widget ) return false; | 17 | if (widget != o.widget ) return false; |
18 | if (icon != o.icon ) return false; | 18 | if (icon != o.icon ) return false; |
19 | if (name != o.name ) return false; | 19 | if (name != o.name ) return false; |
20 | return true; | 20 | return true; |
21 | } | 21 | } |
22 | QWidget* widget; | 22 | QWidget* widget; |
23 | QString icon; | 23 | QString icon; |
24 | QString name; | 24 | QString name; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | } | 27 | } |
28 | } | 28 | } |
29 | } | 29 | } |
30 | 30 | ||
31 | #endif | 31 | #endif |
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp index bcfd3a6..f0287ed 100644 --- a/libopie2/opieui/big-screen/osplitter.cpp +++ b/libopie2/opieui/big-screen/osplitter.cpp | |||
@@ -7,65 +7,65 @@ | |||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library 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 library is distributed in the hope that | 12 | .i_,=:_. -<s. This library 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 | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 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 "osplitter.h" | 29 | #include "osplitter.h" |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | #include <opie2/otabwidget.h> | 32 | #include <opie2/otabwidget.h> |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | 37 | ||
38 | using namespace Opie::Ui; | 38 | using namespace Opie::Ui; |
39 | using namespace Opie::Ui::Private; | 39 | using namespace Opie::Ui::Internal; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * | 42 | * |
43 | * This is the constructor of OSplitter | 43 | * This is the constructor of OSplitter |
44 | * You might want to call setSizeChange to tell | 44 | * You might want to call setSizeChange to tell |
45 | * OSplitter to change its layout when a specefic | 45 | * OSplitter to change its layout when a specefic |
46 | * mark was crossed. OSplitter sets a default value. | 46 | * mark was crossed. OSplitter sets a default value. |
47 | * | 47 | * |
48 | * You cann add widget with addWidget to the OSplitter. | 48 | * You cann add widget with addWidget to the OSplitter. |
49 | * OSplitter supports also grouping of Splitters where they | 49 | * OSplitter supports also grouping of Splitters where they |
50 | * can share one OTabBar in small screen mode. This can be used | 50 | * can share one OTabBar in small screen mode. This can be used |
51 | * for email clients like vies but see the example. | 51 | * for email clients like vies but see the example. |
52 | * | 52 | * |
53 | * @param orient The orientation wether to layout horizontal or vertical | 53 | * @param orient The orientation wether to layout horizontal or vertical |
54 | * @param parent The parent of this widget | 54 | * @param parent The parent of this widget |
55 | * @param name The name passed on to QObject | 55 | * @param name The name passed on to QObject |
56 | * @param fl Additional widgets flags passed to QWidget | 56 | * @param fl Additional widgets flags passed to QWidget |
57 | * | 57 | * |
58 | * @short single c'tor of the OSplitter | 58 | * @short single c'tor of the OSplitter |
59 | */ | 59 | */ |
60 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) | 60 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) |
61 | : QFrame( parent, name, fl ) | 61 | : QFrame( parent, name, fl ) |
62 | { | 62 | { |
63 | m_orient = orient; | 63 | m_orient = orient; |
64 | m_hbox = 0; | 64 | m_hbox = 0; |
65 | m_size_policy = 330; | 65 | m_size_policy = 330; |
66 | setFontPropagation( AllChildren ); | 66 | setFontPropagation( AllChildren ); |
67 | setPalettePropagation( AllChildren ); | 67 | setPalettePropagation( AllChildren ); |
68 | 68 | ||
69 | /* start by default with the tab widget */ | 69 | /* start by default with the tab widget */ |
70 | m_tabWidget = 0; | 70 | m_tabWidget = 0; |
71 | m_parentTab = 0; | 71 | m_parentTab = 0; |
@@ -368,79 +368,79 @@ void OSplitter::resizeEvent( QResizeEvent* res ) | |||
368 | */ | 368 | */ |
369 | // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); | 369 | // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); |
370 | bool mode = true; | 370 | bool mode = true; |
371 | qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); | 371 | qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); |
372 | if ( res->size().width() > m_size_policy && | 372 | if ( res->size().width() > m_size_policy && |
373 | m_orient == Horizontal ) | 373 | m_orient == Horizontal ) |
374 | { | 374 | { |
375 | changeHBox(); | 375 | changeHBox(); |
376 | mode = false; | 376 | mode = false; |
377 | } | 377 | } |
378 | else if ( (res->size().width() <= m_size_policy && | 378 | else if ( (res->size().width() <= m_size_policy && |
379 | m_orient == Horizontal ) || | 379 | m_orient == Horizontal ) || |
380 | (res->size().height() <= m_size_policy && | 380 | (res->size().height() <= m_size_policy && |
381 | m_orient == Vertical ) ) | 381 | m_orient == Vertical ) ) |
382 | { | 382 | { |
383 | changeTab(); | 383 | changeTab(); |
384 | } | 384 | } |
385 | else if ( res->size().height() > m_size_policy && | 385 | else if ( res->size().height() > m_size_policy && |
386 | m_orient == Vertical ) | 386 | m_orient == Vertical ) |
387 | { | 387 | { |
388 | qWarning("Changng to vbox %s", name() ); | 388 | qWarning("Changng to vbox %s", name() ); |
389 | changeVBox(); | 389 | changeVBox(); |
390 | mode = false; | 390 | mode = false; |
391 | } | 391 | } |
392 | 392 | ||
393 | emit sizeChanged(mode, m_orient ); | 393 | emit sizeChanged(mode, m_orient ); |
394 | } | 394 | } |
395 | 395 | ||
396 | /* | 396 | /* |
397 | * Adds a container to a tab either the parent tab | 397 | * Adds a container to a tab either the parent tab |
398 | * or our own | 398 | * or our own |
399 | */ | 399 | */ |
400 | void OSplitter::addToTab( const Opie::Ui::Private::OSplitterContainer& con ) | 400 | void OSplitter::addToTab( const Opie::Ui::Internal::OSplitterContainer& con ) |
401 | { | 401 | { |
402 | QWidget *wid = con.widget; | 402 | QWidget *wid = con.widget; |
403 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); | 403 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); |
404 | if (m_parentTab ) | 404 | if (m_parentTab ) |
405 | m_parentTab->addTab( wid, con.icon, con.name ); | 405 | m_parentTab->addTab( wid, con.icon, con.name ); |
406 | else | 406 | else |
407 | m_tabWidget->addTab( wid, con.icon, con.name ); | 407 | m_tabWidget->addTab( wid, con.icon, con.name ); |
408 | } | 408 | } |
409 | 409 | ||
410 | 410 | ||
411 | /* | 411 | /* |
412 | * adds a container to the box | 412 | * adds a container to the box |
413 | */ | 413 | */ |
414 | void OSplitter::addToBox( const Opie::Ui::Private::OSplitterContainer& con ) | 414 | void OSplitter::addToBox( const Opie::Ui::Internal::OSplitterContainer& con ) |
415 | { | 415 | { |
416 | QWidget* wid = con.widget; | 416 | QWidget* wid = con.widget; |
417 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); | 417 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | /* | 421 | /* |
422 | * Removes a widget from the tab | 422 | * Removes a widget from the tab |
423 | */ | 423 | */ |
424 | void OSplitter::removeFromTab( QWidget* wid ) | 424 | void OSplitter::removeFromTab( QWidget* wid ) |
425 | { | 425 | { |
426 | if (m_parentTab ) | 426 | if (m_parentTab ) |
427 | m_parentTab->removePage( wid ); | 427 | m_parentTab->removePage( wid ); |
428 | else | 428 | else |
429 | m_tabWidget->removePage( wid ); | 429 | m_tabWidget->removePage( wid ); |
430 | } | 430 | } |
431 | 431 | ||
432 | /* | 432 | /* |
433 | * switches over to a OTabWidget layout | 433 | * switches over to a OTabWidget layout |
434 | * it is recursive | 434 | * it is recursive |
435 | */ | 435 | */ |
436 | void OSplitter::changeTab() | 436 | void OSplitter::changeTab() |
437 | { | 437 | { |
438 | /* if we're the owner of the tab widget */ | 438 | /* if we're the owner of the tab widget */ |
439 | if (m_tabWidget ) | 439 | if (m_tabWidget ) |
440 | { | 440 | { |
441 | raise(); | 441 | raise(); |
442 | show(); | 442 | show(); |
443 | m_tabWidget->setGeometry( frameRect() ); | 443 | m_tabWidget->setGeometry( frameRect() ); |
444 | return; | 444 | return; |
445 | } | 445 | } |
446 | 446 | ||
diff --git a/libopie2/opieui/big-screen/osplitter.h b/libopie2/opieui/big-screen/osplitter.h index 7b5ea53..46dad05 100644 --- a/libopie2/opieui/big-screen/osplitter.h +++ b/libopie2/opieui/big-screen/osplitter.h | |||
@@ -44,108 +44,108 @@ class QHBox; | |||
44 | /* | 44 | /* |
45 | * TODO | 45 | * TODO |
46 | * -check API docu | 46 | * -check API docu |
47 | * -one more example | 47 | * -one more example |
48 | * -allow inserting at a position | 48 | * -allow inserting at a position |
49 | */ | 49 | */ |
50 | 50 | ||
51 | namespace Opie{ | 51 | namespace Opie{ |
52 | namespace Ui { | 52 | namespace Ui { |
53 | class OTabWidget; | 53 | class OTabWidget; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * | 56 | * |
57 | * If you've widgets that could be placed side by side but you think | 57 | * If you've widgets that could be placed side by side but you think |
58 | * on small resolutions is not enough place but it would really make sense | 58 | * on small resolutions is not enough place but it would really make sense |
59 | * on bigger resolutions this class will help you. | 59 | * on bigger resolutions this class will help you. |
60 | * You can add as many widgets you want to it. Set a poliy on which width/height it | 60 | * You can add as many widgets you want to it. Set a poliy on which width/height it |
61 | * should switch the layout. | 61 | * should switch the layout. |
62 | * You can either say to place widgets vertical or horizontal. | 62 | * You can either say to place widgets vertical or horizontal. |
63 | * This class uses QHBox, QVBox and QTAbWidget internally. | 63 | * This class uses QHBox, QVBox and QTAbWidget internally. |
64 | * OSplitter takes ownership of the widgets | 64 | * OSplitter takes ownership of the widgets |
65 | * | 65 | * |
66 | * @since 1.2 | 66 | * @since 1.2 |
67 | * | 67 | * |
68 | * @short a small dynamically changing its layout to store two or more widgets side by side | 68 | * @short a small dynamically changing its layout to store two or more widgets side by side |
69 | * @version 0.1 | 69 | * @version 0.1 |
70 | * @author zecke | 70 | * @author zecke |
71 | */ | 71 | */ |
72 | class OSplitter : public QFrame | 72 | class OSplitter : public QFrame |
73 | { | 73 | { |
74 | Q_OBJECT | 74 | Q_OBJECT |
75 | public: | 75 | public: |
76 | typedef QValueList<Opie::Ui::Private::OSplitterContainer> ContainerList; | 76 | typedef QValueList<Opie::Ui::Internal::OSplitterContainer> ContainerList; |
77 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, | 77 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, |
78 | const char* name = 0, WFlags fl = 0 ); | 78 | const char* name = 0, WFlags fl = 0 ); |
79 | ~OSplitter(); | 79 | ~OSplitter(); |
80 | 80 | ||
81 | void setLabel( const QString& name ); | 81 | void setLabel( const QString& name ); |
82 | void setIconName( const QString& name ); | 82 | void setIconName( const QString& name ); |
83 | QString label()const; | 83 | QString label()const; |
84 | QString iconName()const; | 84 | QString iconName()const; |
85 | 85 | ||
86 | void setSizeChange( int width_height ); | 86 | void setSizeChange( int width_height ); |
87 | 87 | ||
88 | void addWidget( OSplitter* splitter ); | 88 | void addWidget( OSplitter* splitter ); |
89 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); | 89 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); |
90 | void removeWidget( QWidget* ); | 90 | void removeWidget( QWidget* ); |
91 | void removeWidget( OSplitter* ); | 91 | void removeWidget( OSplitter* ); |
92 | 92 | ||
93 | void setCurrentWidget( QWidget* ); | 93 | void setCurrentWidget( QWidget* ); |
94 | void setCurrentWidget( const QString& label ); | 94 | void setCurrentWidget( const QString& label ); |
95 | void setCurrentWidget( int ); | 95 | void setCurrentWidget( int ); |
96 | QWidget* currentWidget()const; | 96 | QWidget* currentWidget()const; |
97 | 97 | ||
98 | 98 | ||
99 | signals: | 99 | signals: |
100 | /** | 100 | /** |
101 | * Emitted if in tab and comes directly from the tab widget | 101 | * Emitted if in tab and comes directly from the tab widget |
102 | * | 102 | * |
103 | */ | 103 | */ |
104 | void currentChanged( QWidget* ); | 104 | void currentChanged( QWidget* ); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * emitted whenever a border is crossed | 107 | * emitted whenever a border is crossed |
108 | * true if in small screen mode | 108 | * true if in small screen mode |
109 | * false if in bigscreen | 109 | * false if in bigscreen |
110 | * this signal is emitted after the layout switch | 110 | * this signal is emitted after the layout switch |
111 | * @param b The layout mode | 111 | * @param b The layout mode |
112 | * @param ori The orientation | 112 | * @param ori The orientation |
113 | */ | 113 | */ |
114 | void sizeChanged( bool b, Orientation ori); | 114 | void sizeChanged( bool b, Orientation ori); |
115 | public: | 115 | public: |
116 | // QSize sizeHint()const; | 116 | // QSize sizeHint()const; |
117 | // QSize minimumSizeHint()const; | 117 | // QSize minimumSizeHint()const; |
118 | 118 | ||
119 | protected: | 119 | protected: |
120 | void resizeEvent( QResizeEvent* ); | 120 | void resizeEvent( QResizeEvent* ); |
121 | 121 | ||
122 | private: | 122 | private: |
123 | /* true if OTabMode */ | 123 | /* true if OTabMode */ |
124 | bool layoutMode()const; | 124 | bool layoutMode()const; |
125 | // void reparentAll(); | 125 | // void reparentAll(); |
126 | void setTabWidget( OTabWidget*); | 126 | void setTabWidget( OTabWidget*); |
127 | void addToTab( const Opie::Ui::Private::OSplitterContainer& ); | 127 | void addToTab( const Opie::Ui::Internal::OSplitterContainer& ); |
128 | void addToBox( const Opie::Ui::Private::OSplitterContainer& ); | 128 | void addToBox( const Opie::Ui::Internal::OSplitterContainer& ); |
129 | void removeFromTab( QWidget* ); | 129 | void removeFromTab( QWidget* ); |
130 | void changeTab(); | 130 | void changeTab(); |
131 | void changeHBox(); | 131 | void changeHBox(); |
132 | void changeVBox(); | 132 | void changeVBox(); |
133 | void commonChangeBox(); | 133 | void commonChangeBox(); |
134 | QHBox *m_hbox; | 134 | QHBox *m_hbox; |
135 | OTabWidget *m_tabWidget; | 135 | OTabWidget *m_tabWidget; |
136 | OTabWidget *m_parentTab; | 136 | OTabWidget *m_parentTab; |
137 | Orientation m_orient; | 137 | Orientation m_orient; |
138 | int m_size_policy; | 138 | int m_size_policy; |
139 | 139 | ||
140 | ContainerList m_container; | 140 | ContainerList m_container; |
141 | QList<OSplitter> m_splitter; | 141 | QList<OSplitter> m_splitter; |
142 | 142 | ||
143 | QString m_icon, m_name; | 143 | QString m_icon, m_name; |
144 | 144 | ||
145 | struct Private; | 145 | struct Private; |
146 | Private *d; | 146 | Private *d; |
147 | }; | 147 | }; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | #endif | 151 | #endif |
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index c4d5033..a9ec8c4 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -1,94 +1,95 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | =. This file is part of the OPIE Project | 3 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> | 4 | .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> |
4 | .>+-= | 5 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 6 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 12 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 13 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 20 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
26 | 27 | ||
27 | */ | 28 | */ |
28 | 29 | ||
29 | /* hacky but we need to get FileSelector::filter */ | 30 | /* hacky but we need to get FileSelector::filter */ |
30 | #define private public | 31 | #define private public |
31 | #include <qpe/fileselector.h> | 32 | #include <qpe/fileselector.h> |
32 | #undef private | 33 | #undef private |
33 | 34 | ||
34 | #include "ofileselector_p.h" | 35 | #include "ofileselector_p.h" |
35 | 36 | ||
36 | /* OPIE */ | 37 | /* OPIE */ |
37 | #include <opie2/ofileselector.h> | 38 | #include <opie2/ofileselector.h> |
38 | 39 | ||
39 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
40 | #include <qpe/mimetype.h> | 41 | #include <qpe/mimetype.h> |
41 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
42 | #include <qpe/storage.h> | 43 | #include <qpe/storage.h> |
43 | 44 | ||
44 | /* QT */ | 45 | /* QT */ |
45 | #include <qcombobox.h> | 46 | #include <qcombobox.h> |
46 | #include <qdir.h> | 47 | #include <qdir.h> |
47 | #include <qhbox.h> | 48 | #include <qhbox.h> |
48 | #include <qheader.h> | 49 | #include <qheader.h> |
49 | #include <qlabel.h> | 50 | #include <qlabel.h> |
50 | #include <qlayout.h> | 51 | #include <qlayout.h> |
51 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
52 | #include <qlistview.h> | 53 | #include <qlistview.h> |
53 | #include <qpopupmenu.h> | 54 | #include <qpopupmenu.h> |
54 | #include <qwidgetstack.h> | 55 | #include <qwidgetstack.h> |
55 | #include <qregexp.h> | 56 | #include <qregexp.h> |
56 | #include <qobjectlist.h> | 57 | #include <qobjectlist.h> |
57 | 58 | ||
58 | using namespace Opie::Ui::Private; | 59 | using namespace Opie::Ui::Internal; |
59 | 60 | ||
60 | namespace Opie { | 61 | namespace Opie { |
61 | namespace Ui { | 62 | namespace Ui { |
62 | namespace Private { | 63 | namespace Internal { |
63 | OFileViewInterface::OFileViewInterface( OFileSelector* selector ) | 64 | OFileViewInterface::OFileViewInterface( OFileSelector* selector ) |
64 | : m_selector( selector ) | 65 | : m_selector( selector ) |
65 | {} | 66 | {} |
66 | 67 | ||
67 | OFileViewInterface::~OFileViewInterface() | 68 | OFileViewInterface::~OFileViewInterface() |
68 | {} | 69 | {} |
69 | 70 | ||
70 | QString OFileViewInterface::name()const | 71 | QString OFileViewInterface::name()const |
71 | { | 72 | { |
72 | return m_name; | 73 | return m_name; |
73 | } | 74 | } |
74 | 75 | ||
75 | void OFileViewInterface::setName( const QString& name ) | 76 | void OFileViewInterface::setName( const QString& name ) |
76 | { | 77 | { |
77 | m_name = name; | 78 | m_name = name; |
78 | } | 79 | } |
79 | 80 | ||
80 | OFileSelector* OFileViewInterface::selector()const | 81 | OFileSelector* OFileViewInterface::selector()const |
81 | { | 82 | { |
82 | return m_selector; | 83 | return m_selector; |
83 | } | 84 | } |
84 | 85 | ||
85 | DocLnk OFileViewInterface::selectedDocument()const | 86 | DocLnk OFileViewInterface::selectedDocument()const |
86 | { | 87 | { |
87 | return DocLnk( selectedName() ); | 88 | return DocLnk( selectedName() ); |
88 | } | 89 | } |
89 | 90 | ||
90 | bool OFileViewInterface::showNew()const | 91 | bool OFileViewInterface::showNew()const |
91 | { | 92 | { |
92 | return selector()->showNew(); | 93 | return selector()->showNew(); |
93 | } | 94 | } |
94 | 95 | ||
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h index 2205963..8bcd9ee 100644 --- a/libopie2/opieui/fileselector/ofileselector.h +++ b/libopie2/opieui/fileselector/ofileselector.h | |||
@@ -26,86 +26,86 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* | 29 | /* |
30 | This is based on code and ideas of | 30 | This is based on code and ideas of |
31 | L. J. Potter ljp@llornkcor.com | 31 | L. J. Potter ljp@llornkcor.com |
32 | Thanks a lot | 32 | Thanks a lot |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #ifndef OFILESELECTOR_H | 35 | #ifndef OFILESELECTOR_H |
36 | #define OFILESELECTOR_H | 36 | #define OFILESELECTOR_H |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <qpe/applnk.h> | 39 | #include <qpe/applnk.h> |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qlist.h> | 42 | #include <qlist.h> |
43 | #include <qwidget.h> | 43 | #include <qwidget.h> |
44 | #include <qmap.h> | 44 | #include <qmap.h> |
45 | #include <qvaluelist.h> | 45 | #include <qvaluelist.h> |
46 | #include <qstringlist.h> | 46 | #include <qstringlist.h> |
47 | 47 | ||
48 | class QLineEdit; | 48 | class QLineEdit; |
49 | class QComboBox; | 49 | class QComboBox; |
50 | class QWidgetStack; | 50 | class QWidgetStack; |
51 | class QHBox; | 51 | class QHBox; |
52 | 52 | ||
53 | typedef QMap<QString, QStringList> MimeTypes; | 53 | typedef QMap<QString, QStringList> MimeTypes; |
54 | 54 | ||
55 | namespace Opie { | 55 | namespace Opie { |
56 | namespace Ui { | 56 | namespace Ui { |
57 | 57 | ||
58 | namespace Private { | 58 | namespace Internal { |
59 | class OFileViewInterface; | 59 | class OFileViewInterface; |
60 | class OFileViewFileListView; | 60 | class OFileViewFileListView; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | /** | 64 | /** |
65 | * @short a dropin replacement for the FileSelector | 65 | * @short a dropin replacement for the FileSelector |
66 | * | 66 | * |
67 | * This class is first used insert the OFileDialog. | 67 | * This class is first used insert the OFileDialog. |
68 | * It supports multiple view and mimetype filtering for now. | 68 | * It supports multiple view and mimetype filtering for now. |
69 | * | 69 | * |
70 | * @see OFileDialog | 70 | * @see OFileDialog |
71 | * @see FileSelector | 71 | * @see FileSelector |
72 | * @author zecke | 72 | * @author zecke |
73 | * @version 0.1 | 73 | * @version 0.1 |
74 | */ | 74 | */ |
75 | class OFileSelector : public QWidget | 75 | class OFileSelector : public QWidget |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | friend class Private::OFileViewInterface; | 78 | friend class Internal::OFileViewInterface; |
79 | friend class Private::OFileViewFileListView; | 79 | friend class Internal::OFileViewFileListView; |
80 | 80 | ||
81 | public: | 81 | public: |
82 | /** | 82 | /** |
83 | * The Mode of the Fileselector | 83 | * The Mode of the Fileselector |
84 | * Open = Open A File | 84 | * Open = Open A File |
85 | * Save = Save a File | 85 | * Save = Save a File |
86 | * FILESELECTOR = As A GUI in a screen to select a file | 86 | * FILESELECTOR = As A GUI in a screen to select a file |
87 | */ | 87 | */ |
88 | enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; | 88 | enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; |
89 | // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; | 89 | // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; |
90 | /** | 90 | /** |
91 | * Normal = The old FileSelector | 91 | * Normal = The old FileSelector |
92 | * Extended = Dir View | 92 | * Extended = Dir View |
93 | * ExtendedAll = Dir View with all hidden files | 93 | * ExtendedAll = Dir View with all hidden files |
94 | * Default = What the vendor considers best | 94 | * Default = What the vendor considers best |
95 | */ | 95 | */ |
96 | enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; | 96 | enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; |
97 | // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2}; | 97 | // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2}; |
98 | 98 | ||
99 | OFileSelector(QWidget* parent, int mode, int selector, | 99 | OFileSelector(QWidget* parent, int mode, int selector, |
100 | const QString& dirName, | 100 | const QString& dirName, |
101 | const QString& fileName, | 101 | const QString& fileName, |
102 | const MimeTypes& mimetypes = MimeTypes(), | 102 | const MimeTypes& mimetypes = MimeTypes(), |
103 | bool newVisible = FALSE, bool closeVisible = FALSE ); | 103 | bool newVisible = FALSE, bool closeVisible = FALSE ); |
104 | 104 | ||
105 | OFileSelector(const QString& mimeFilter, QWidget* parent, | 105 | OFileSelector(const QString& mimeFilter, QWidget* parent, |
106 | const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); | 106 | const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); |
107 | ~OFileSelector(); | 107 | ~OFileSelector(); |
108 | 108 | ||
109 | const DocLnk* selected(); | 109 | const DocLnk* selected(); |
110 | 110 | ||
111 | QString selectedName()const; | 111 | QString selectedName()const; |
@@ -158,65 +158,65 @@ signals: | |||
158 | * Create a new File with a DocLnk | 158 | * Create a new File with a DocLnk |
159 | */ | 159 | */ |
160 | void newSelected( const DocLnk& ); | 160 | void newSelected( const DocLnk& ); |
161 | 161 | ||
162 | void closeMe(); | 162 | void closeMe(); |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * Ok is emitted on a Qt::Key_Return or Q::Key_Enter | 165 | * Ok is emitted on a Qt::Key_Return or Q::Key_Enter |
166 | * in the line edit | 166 | * in the line edit |
167 | */ | 167 | */ |
168 | void ok(); | 168 | void ok(); |
169 | void cancel(); | 169 | void cancel(); |
170 | 170 | ||
171 | /* used by the ViewInterface */ | 171 | /* used by the ViewInterface */ |
172 | private: | 172 | private: |
173 | bool showNew()const; | 173 | bool showNew()const; |
174 | bool showClose()const; | 174 | bool showClose()const; |
175 | MimeTypes mimeTypes()const; | 175 | MimeTypes mimeTypes()const; |
176 | QStringList currentMimeType()const; | 176 | QStringList currentMimeType()const; |
177 | 177 | ||
178 | private: | 178 | private: |
179 | /* inits the Widgets */ | 179 | /* inits the Widgets */ |
180 | void initUI(); | 180 | void initUI(); |
181 | /* inits the MimeType ComboBox content + connects signals and slots */ | 181 | /* inits the MimeType ComboBox content + connects signals and slots */ |
182 | void initMime(); | 182 | void initMime(); |
183 | /* init the Views :) */ | 183 | /* init the Views :) */ |
184 | void initViews(); | 184 | void initViews(); |
185 | 185 | ||
186 | private: | 186 | private: |
187 | QLineEdit* m_lneEdit; // the LineEdit for the Name | 187 | QLineEdit* m_lneEdit; // the LineEdit for the Name |
188 | QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType | 188 | QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType |
189 | QWidgetStack* m_stack; // our widget stack which will contain the views | 189 | QWidgetStack* m_stack; // our widget stack which will contain the views |
190 | Private::OFileViewInterface* currentView() const; // returns the currentView | 190 | Internal::OFileViewInterface* currentView() const; // returns the currentView |
191 | Private::OFileViewInterface* m_current; // here is the view saved | 191 | Internal::OFileViewInterface* m_current; // here is the view saved |
192 | bool m_shNew : 1; // should we show New? | 192 | bool m_shNew : 1; // should we show New? |
193 | bool m_shClose : 1; // should we show Close? | 193 | bool m_shClose : 1; // should we show Close? |
194 | MimeTypes m_mimeType; // list of mimetypes | 194 | MimeTypes m_mimeType; // list of mimetypes |
195 | 195 | ||
196 | QMap<QString, Private::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr | 196 | QMap<QString, Internal::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr |
197 | QHBox* m_nameBox; // the LineEdit + Label is hold here | 197 | QHBox* m_nameBox; // the LineEdit + Label is hold here |
198 | QHBox* m_cmbBox; // this holds the two combo boxes | 198 | QHBox* m_cmbBox; // this holds the two combo boxes |
199 | 199 | ||
200 | QString m_startDir; | 200 | QString m_startDir; |
201 | int m_mode; | 201 | int m_mode; |
202 | int m_selector; | 202 | int m_selector; |
203 | 203 | ||
204 | struct Data; // used for future versions | 204 | struct Data; // used for future versions |
205 | Data *d; | 205 | Data *d; |
206 | 206 | ||
207 | private slots: | 207 | private slots: |
208 | void slotMimeTypeChanged(); | 208 | void slotMimeTypeChanged(); |
209 | 209 | ||
210 | /* will set the text of the lineedit and emit a fileChanged signal */ | 210 | /* will set the text of the lineedit and emit a fileChanged signal */ |
211 | void slotDocLnkBridge( const DocLnk& ); | 211 | void slotDocLnkBridge( const DocLnk& ); |
212 | void slotFileBridge( const QString& ); | 212 | void slotFileBridge( const QString& ); |
213 | void slotViewChange( const QString& ); | 213 | void slotViewChange( const QString& ); |
214 | 214 | ||
215 | bool eventFilter (QObject *o, QEvent *e); | 215 | bool eventFilter (QObject *o, QEvent *e); |
216 | 216 | ||
217 | }; | 217 | }; |
218 | 218 | ||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | #endif | 222 | #endif |
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h index 376dc98..a3ef8e2 100644 --- a/libopie2/opieui/fileselector/ofileselector_p.h +++ b/libopie2/opieui/fileselector/ofileselector_p.h | |||
@@ -30,65 +30,65 @@ | |||
30 | #define OFILESELECTOR_PRIVATE_H | 30 | #define OFILESELECTOR_PRIVATE_H |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/fileselector.h> | 34 | #include <qpe/fileselector.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qmap.h> | 37 | #include <qmap.h> |
38 | #include <qstringlist.h> | 38 | #include <qstringlist.h> |
39 | #include <qwidget.h> | 39 | #include <qwidget.h> |
40 | #include <qlistview.h> | 40 | #include <qlistview.h> |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * How to avoid having really two different objects | 43 | * How to avoid having really two different objects |
44 | * for Extended and ExtendedAll | 44 | * for Extended and ExtendedAll |
45 | * The only difference is the Lister... | 45 | * The only difference is the Lister... |
46 | * a) static object? | 46 | * a) static object? |
47 | * b) leave some object inside the OFileSelector which can be used? | 47 | * b) leave some object inside the OFileSelector which can be used? |
48 | * c) when switching views tell which view we want o have.. internally we can switch then | 48 | * c) when switching views tell which view we want o have.. internally we can switch then |
49 | * | 49 | * |
50 | * I'll take c) -zecke | 50 | * I'll take c) -zecke |
51 | */ | 51 | */ |
52 | 52 | ||
53 | typedef QMap<QString, QStringList> MimeTypes; | 53 | typedef QMap<QString, QStringList> MimeTypes; |
54 | 54 | ||
55 | /* the View Interface */ | 55 | /* the View Interface */ |
56 | class QFileInfo; | 56 | class QFileInfo; |
57 | class QToolButton; | 57 | class QToolButton; |
58 | 58 | ||
59 | namespace Opie{ | 59 | namespace Opie{ |
60 | namespace Ui{ | 60 | namespace Ui{ |
61 | class OFileSelector; | 61 | class OFileSelector; |
62 | namespace Private { | 62 | namespace Internal { |
63 | 63 | ||
64 | class OFileViewInterface | 64 | class OFileViewInterface |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | OFileViewInterface( OFileSelector* selector ); | 67 | OFileViewInterface( OFileSelector* selector ); |
68 | virtual ~OFileViewInterface(); | 68 | virtual ~OFileViewInterface(); |
69 | virtual QString selectedName()const = 0; | 69 | virtual QString selectedName()const = 0; |
70 | virtual QString selectedPath()const = 0; | 70 | virtual QString selectedPath()const = 0; |
71 | virtual QString directory()const = 0; | 71 | virtual QString directory()const = 0; |
72 | virtual void reread() = 0; | 72 | virtual void reread() = 0; |
73 | virtual int fileCount()const = 0; | 73 | virtual int fileCount()const = 0; |
74 | virtual DocLnk selectedDocument()const; | 74 | virtual DocLnk selectedDocument()const; |
75 | virtual QWidget* widget( QWidget* parent) = 0; | 75 | virtual QWidget* widget( QWidget* parent) = 0; |
76 | virtual void activate( const QString& ); | 76 | virtual void activate( const QString& ); |
77 | QString name()const; | 77 | QString name()const; |
78 | protected: | 78 | protected: |
79 | OFileSelector* selector()const; | 79 | OFileSelector* selector()const; |
80 | void setName( const QString& ); | 80 | void setName( const QString& ); |
81 | bool showNew()const; | 81 | bool showNew()const; |
82 | bool showClose()const; | 82 | bool showClose()const; |
83 | MimeTypes mimeTypes()const; | 83 | MimeTypes mimeTypes()const; |
84 | QStringList currentMimeType()const; | 84 | QStringList currentMimeType()const; |
85 | QString startDirectory()const; | 85 | QString startDirectory()const; |
86 | protected: | 86 | protected: |
87 | void ok(); | 87 | void ok(); |
88 | void cancel(); | 88 | void cancel(); |
89 | void closeMe(); | 89 | void closeMe(); |
90 | void fileSelected( const QString& ); | 90 | void fileSelected( const QString& ); |
91 | void fileSelected( const DocLnk& ); | 91 | void fileSelected( const DocLnk& ); |
92 | void setCurrentFileName( const QString& ); | 92 | void setCurrentFileName( const QString& ); |
93 | QString currentFileName()const; | 93 | QString currentFileName()const; |
94 | 94 | ||
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp index b19c26e..6763ee6 100644 --- a/libopie2/opieui/ofontselector.cpp +++ b/libopie2/opieui/ofontselector.cpp | |||
@@ -12,120 +12,120 @@ | |||
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <opie2/ofontselector.h> | 31 | #include <opie2/ofontselector.h> |
32 | #include <qpe/fontdatabase.h> | 32 | #include <qpe/fontdatabase.h> |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qlistbox.h> | 36 | #include <qlistbox.h> |
37 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qmultilineedit.h> | 39 | #include <qmultilineedit.h> |
40 | 40 | ||
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | namespace Ui { | 43 | namespace Ui { |
44 | namespace Private { | 44 | namespace Internal { |
45 | 45 | ||
46 | class OFontSelectorPrivate | 46 | class OFontSelectorPrivate |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | QListBox * m_font_family_list; | 49 | QListBox * m_font_family_list; |
50 | QComboBox * m_font_style_list; | 50 | QComboBox * m_font_style_list; |
51 | QComboBox * m_font_size_list; | 51 | QComboBox * m_font_size_list; |
52 | QMultiLineEdit *m_preview; | 52 | QMultiLineEdit *m_preview; |
53 | 53 | ||
54 | bool m_pointbug : 1; | 54 | bool m_pointbug : 1; |
55 | 55 | ||
56 | FontDatabase m_fdb; | 56 | FontDatabase m_fdb; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | class FontListItem : public QListBoxText | 59 | class FontListItem : public QListBoxText |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() | 62 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() |
63 | { | 63 | { |
64 | m_name = t; | 64 | m_name = t; |
65 | m_styles = styles; | 65 | m_styles = styles; |
66 | m_sizes = sizes; | 66 | m_sizes = sizes; |
67 | 67 | ||
68 | QString str = t; | 68 | QString str = t; |
69 | str [0] = str [0]. upper(); | 69 | str [0] = str [0]. upper(); |
70 | setText ( str ); | 70 | setText ( str ); |
71 | } | 71 | } |
72 | 72 | ||
73 | QString family() const | 73 | QString family() const |
74 | { | 74 | { |
75 | return m_name; | 75 | return m_name; |
76 | } | 76 | } |
77 | 77 | ||
78 | const QStringList &styles() const | 78 | const QStringList &styles() const |
79 | { | 79 | { |
80 | return m_styles; | 80 | return m_styles; |
81 | } | 81 | } |
82 | 82 | ||
83 | const QValueList<int> &sizes() const | 83 | const QValueList<int> &sizes() const |
84 | { | 84 | { |
85 | return m_sizes; | 85 | return m_sizes; |
86 | } | 86 | } |
87 | 87 | ||
88 | private: | 88 | private: |
89 | QStringList m_styles; | 89 | QStringList m_styles; |
90 | QValueList<int> m_sizes; | 90 | QValueList<int> m_sizes; |
91 | QString m_name; | 91 | QString m_name; |
92 | }; | 92 | }; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | using namespace Opie::Ui; | 98 | using namespace Opie::Ui; |
99 | using namespace Opie::Ui::Private; | 99 | using namespace Opie::Ui::Internal; |
100 | 100 | ||
101 | static int findItemCB( QComboBox *box, const QString &str ) | 101 | static int findItemCB( QComboBox *box, const QString &str ) |
102 | { | 102 | { |
103 | for ( int i = 0; i < box->count(); i++ ) | 103 | for ( int i = 0; i < box->count(); i++ ) |
104 | { | 104 | { |
105 | if ( box->text ( i ) == str ) | 105 | if ( box->text ( i ) == str ) |
106 | return i; | 106 | return i; |
107 | } | 107 | } |
108 | return -1; | 108 | return -1; |
109 | } | 109 | } |
110 | 110 | ||
111 | /* static same as anon. namespace */ | 111 | /* static same as anon. namespace */ |
112 | static int qt_version() | 112 | static int qt_version() |
113 | { | 113 | { |
114 | const char *qver = qVersion(); | 114 | const char *qver = qVersion(); |
115 | 115 | ||
116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Constructs the Selector object | 120 | * Constructs the Selector object |
121 | * @param withpreview If a font preview should be given | 121 | * @param withpreview If a font preview should be given |
122 | * @param parent The parent of the Font Selector | 122 | * @param parent The parent of the Font Selector |
123 | * @param name The name of the object | 123 | * @param name The name of the object |
124 | * @param fl WidgetFlags | 124 | * @param fl WidgetFlags |
125 | */ | 125 | */ |
126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
127 | { | 127 | { |
128 | d = new OFontSelectorPrivate(); | 128 | d = new OFontSelectorPrivate(); |
129 | 129 | ||
130 | QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); | 130 | QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); |
131 | gridLayout->setRowStretch( 4, 10 ); | 131 | gridLayout->setRowStretch( 4, 10 ); |
diff --git a/libopie2/opieui/ofontselector.h b/libopie2/opieui/ofontselector.h index 1d97233..cd134f4 100644 --- a/libopie2/opieui/ofontselector.h +++ b/libopie2/opieui/ofontselector.h | |||
@@ -8,99 +8,99 @@ | |||
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OFONTSELECTOR_H | 30 | #ifndef OFONTSELECTOR_H |
31 | #define OFONTSELECTOR_H | 31 | #define OFONTSELECTOR_H |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | 35 | ||
36 | class QListBox; | 36 | class QListBox; |
37 | 37 | ||
38 | namespace Opie { | 38 | namespace Opie { |
39 | namespace Ui { | 39 | namespace Ui { |
40 | namespace Private { | 40 | namespace Internal { |
41 | class OFontSelectorPrivate; | 41 | class OFontSelectorPrivate; |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * This class lets you chose a Font out of a list of Fonts. | 45 | * This class lets you chose a Font out of a list of Fonts. |
46 | * It can show a preview too. This selector will use all available | 46 | * It can show a preview too. This selector will use all available |
47 | * fonts | 47 | * fonts |
48 | * | 48 | * |
49 | * | 49 | * |
50 | * @short A widget to select a font | 50 | * @short A widget to select a font |
51 | * @see QWidget | 51 | * @see QWidget |
52 | * @see QFont | 52 | * @see QFont |
53 | * @author Rober Griebl | 53 | * @author Rober Griebl |
54 | */ | 54 | */ |
55 | class OFontSelector : public QWidget | 55 | class OFontSelector : public QWidget |
56 | { | 56 | { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | 58 | ||
59 | public: | 59 | public: |
60 | OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 60 | OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
61 | virtual ~OFontSelector ( ); | 61 | virtual ~OFontSelector ( ); |
62 | 62 | ||
63 | bool selectedFont ( QString &family, QString &style, int &size ); | 63 | bool selectedFont ( QString &family, QString &style, int &size ); |
64 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); | 64 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); |
65 | 65 | ||
66 | QFont selectedFont ( ); | 66 | QFont selectedFont ( ); |
67 | 67 | ||
68 | bool setSelectedFont ( const QFont & ); | 68 | bool setSelectedFont ( const QFont & ); |
69 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); | 69 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); |
70 | 70 | ||
71 | QString fontFamily ( ) const; | 71 | QString fontFamily ( ) const; |
72 | QString fontStyle ( ) const; | 72 | QString fontStyle ( ) const; |
73 | int fontSize ( ) const; | 73 | int fontSize ( ) const; |
74 | QString fontCharSet ( ) const; | 74 | QString fontCharSet ( ) const; |
75 | 75 | ||
76 | signals: | 76 | signals: |
77 | /** | 77 | /** |
78 | * This signal gets emitted when a font got chosen | 78 | * This signal gets emitted when a font got chosen |
79 | */ | 79 | */ |
80 | void fontSelected ( const QFont & ); | 80 | void fontSelected ( const QFont & ); |
81 | 81 | ||
82 | protected slots: | 82 | protected slots: |
83 | /** @internal */ | 83 | /** @internal */ |
84 | virtual void fontFamilyClicked ( int ); | 84 | virtual void fontFamilyClicked ( int ); |
85 | /** @internal */ | 85 | /** @internal */ |
86 | virtual void fontStyleClicked ( int ); | 86 | virtual void fontStyleClicked ( int ); |
87 | /** @internal */ | 87 | /** @internal */ |
88 | virtual void fontSizeClicked ( int ); | 88 | virtual void fontSizeClicked ( int ); |
89 | 89 | ||
90 | protected: | 90 | protected: |
91 | virtual void resizeEvent ( QResizeEvent *re ); | 91 | virtual void resizeEvent ( QResizeEvent *re ); |
92 | 92 | ||
93 | private: | 93 | private: |
94 | void loadFonts ( QListBox * ); | 94 | void loadFonts ( QListBox * ); |
95 | 95 | ||
96 | void changeFont ( ); | 96 | void changeFont ( ); |
97 | 97 | ||
98 | private: | 98 | private: |
99 | Private::OFontSelectorPrivate *d; | 99 | Internal::OFontSelectorPrivate *d; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | #endif | 105 | #endif |
106 | 106 | ||
diff --git a/libopie2/opieui/okeyconfigwidget.cpp b/libopie2/opieui/okeyconfigwidget.cpp index ef6d713..eb7acbd 100644 --- a/libopie2/opieui/okeyconfigwidget.cpp +++ b/libopie2/opieui/okeyconfigwidget.cpp | |||
@@ -445,135 +445,136 @@ bool OKeyConfigItem::operator!=( const OKeyConfigItem& conf )const { | |||
445 | * | 445 | * |
446 | * @param conf The Config where the KeySetting should be stored | 446 | * @param conf The Config where the KeySetting should be stored |
447 | * @param group The group where the KeySetting will be stored | 447 | * @param group The group where the KeySetting will be stored |
448 | * @param black Which keys shouldn't be allowed to handle | 448 | * @param black Which keys shouldn't be allowed to handle |
449 | * @param grabkeyboard Calls QPEApplication::grabKeyboard to allow handling of DeviceButtons | 449 | * @param grabkeyboard Calls QPEApplication::grabKeyboard to allow handling of DeviceButtons |
450 | * @param par The parent/owner of this manager | 450 | * @param par The parent/owner of this manager |
451 | * @param name The name of this object | 451 | * @param name The name of this object |
452 | */ | 452 | */ |
453 | OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf, | 453 | OKeyConfigManager::OKeyConfigManager( Opie::Core::OConfig* conf, |
454 | const QString& group, | 454 | const QString& group, |
455 | const OKeyPair::List& black, | 455 | const OKeyPair::List& black, |
456 | bool grabkeyboard, QObject* par, | 456 | bool grabkeyboard, QObject* par, |
457 | const char* name) | 457 | const char* name) |
458 | : QObject( par, name ), m_conf( conf ), m_group( group ), | 458 | : QObject( par, name ), m_conf( conf ), m_group( group ), |
459 | m_blackKeys( black ), m_grab( grabkeyboard ), m_map( 0 ){ | 459 | m_blackKeys( black ), m_grab( grabkeyboard ), m_map( 0 ){ |
460 | if ( m_grab ) | 460 | if ( m_grab ) |
461 | QPEApplication::grabKeyboard(); | 461 | QPEApplication::grabKeyboard(); |
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | /** | 465 | /** |
466 | * Destructor | 466 | * Destructor |
467 | */ | 467 | */ |
468 | OKeyConfigManager::~OKeyConfigManager() { | 468 | OKeyConfigManager::~OKeyConfigManager() { |
469 | if ( m_grab ) | 469 | if ( m_grab ) |
470 | QPEApplication::ungrabKeyboard(); | 470 | QPEApplication::ungrabKeyboard(); |
471 | } | 471 | } |
472 | 472 | ||
473 | /** | 473 | /** |
474 | * Load the Configuration from the OConfig | 474 | * Load the Configuration from the OConfig |
475 | * If a Key is restricted but was in the config we will | 475 | * If a Key is restricted but was in the config we will |
476 | * make it be the empty key paur | 476 | * make it be the empty key paur |
477 | * We will change the group of the OConfig Item! | 477 | * We will change the group but restore to the previous. |
478 | * | 478 | * |
479 | * @see OKeyPair::emptyKey | 479 | * @see OKeyPair::emptyKey |
480 | */ | 480 | */ |
481 | void OKeyConfigManager::load() { | 481 | void OKeyConfigManager::load() { |
482 | m_conf->setGroup( m_group ); | 482 | Opie::Core::OConfigGroupSaver( m_conf, m_group ); |
483 | 483 | ||
484 | /* | 484 | /* |
485 | * Read each item | 485 | * Read each item |
486 | */ | 486 | */ |
487 | int key, mod; | 487 | int key, mod; |
488 | for( OKeyConfigItem::List::Iterator it = m_keys.begin(); it != m_keys.end(); ++it ) { | 488 | for( OKeyConfigItem::List::Iterator it = m_keys.begin(); it != m_keys.end(); ++it ) { |
489 | key = m_conf->readNumEntry( (*it).configKey()+"key", (*it).defaultKeyPair().keycode() ); | 489 | key = m_conf->readNumEntry( (*it).configKey()+"key", (*it).defaultKeyPair().keycode() ); |
490 | mod = m_conf->readNumEntry( (*it).configKey()+"mod", (*it).defaultKeyPair().modifier() ); | 490 | mod = m_conf->readNumEntry( (*it).configKey()+"mod", (*it).defaultKeyPair().modifier() ); |
491 | OKeyPair okey( key, mod ); | 491 | OKeyPair okey( key, mod ); |
492 | 492 | ||
493 | if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 ) | 493 | if ( !m_blackKeys.contains( okey ) && key != -1 && mod != -1 ) |
494 | (*it).setKeyPair( OKeyPair(key, mod) ); | 494 | (*it).setKeyPair( OKeyPair(key, mod) ); |
495 | else | 495 | else |
496 | (*it).setKeyPair( OKeyPair::emptyKey() ); | 496 | (*it).setKeyPair( OKeyPair::emptyKey() ); |
497 | } | 497 | } |
498 | delete m_map; m_map = 0; | 498 | delete m_map; m_map = 0; |
499 | } | 499 | } |
500 | 500 | ||
501 | /** | 501 | /** |
502 | * We will save the current configuration | 502 | * We will save the current configuration |
503 | * to the OConfig. We will change the group. | 503 | * to the OConfig. We will change the group but restore |
504 | * to the previous | ||
504 | */ | 505 | */ |
505 | void OKeyConfigManager::save() { | 506 | void OKeyConfigManager::save() { |
506 | m_conf->setGroup( m_group ); | 507 | Opie::Core::OConfigGroupSaver( m_conf, m_group ); |
507 | 508 | ||
508 | /* | 509 | /* |
509 | * Write each item | 510 | * Write each item |
510 | */ | 511 | */ |
511 | for( OKeyConfigItem::List::Iterator it = m_keys.begin();it != m_keys.end(); ++it ) { | 512 | for( OKeyConfigItem::List::Iterator it = m_keys.begin();it != m_keys.end(); ++it ) { |
512 | /* skip empty items */ | 513 | /* skip empty items */ |
513 | if ( (*it).isEmpty() ) | 514 | if ( (*it).isEmpty() ) |
514 | continue; | 515 | continue; |
515 | OKeyPair pair = (*it).keyPair(); | 516 | OKeyPair pair = (*it).keyPair(); |
516 | OKeyPair deft = (*it).defaultKeyPair(); | 517 | OKeyPair deft = (*it).defaultKeyPair(); |
517 | /* | 518 | /* |
518 | * don't write if it is the default setting | 519 | * don't write if it is the default setting |
519 | * FIXME allow to remove Keys from config | 520 | * FIXME allow to remove Keys from config |
520 | if ( (pair.keycode() == deft.keycode()) && | 521 | if ( (pair.keycode() == deft.keycode()) && |
521 | (pair.modifier()== deft.modifier() ) ) | 522 | (pair.modifier()== deft.modifier() ) ) |
522 | return; | 523 | return; |
523 | */ | 524 | */ |
524 | 525 | ||
525 | m_conf->writeEntry((*it).configKey()+"key", pair.keycode() ); | 526 | m_conf->writeEntry((*it).configKey()+"key", pair.keycode() ); |
526 | m_conf->writeEntry((*it).configKey()+"mod", pair.modifier() ); | 527 | m_conf->writeEntry((*it).configKey()+"mod", pair.modifier() ); |
527 | } | 528 | } |
528 | } | 529 | } |
529 | 530 | ||
530 | /** | 531 | /** |
531 | * This is function uses a QMap internally but you can have the same keycode | 532 | * This is function uses a QMap internally but you can have the same keycode |
532 | * with different modifier key. The behaviour is undefined if you add a OKeyConfigItem | 533 | * with different modifier key. The behaviour is undefined if you add a OKeyConfigItem |
533 | * with same keycode and modifier key. The GUI takes care that a user can't | 534 | * with same keycode and modifier key. The GUI takes care that a user can't |
534 | * cofigure two keys. | 535 | * cofigure two keys. |
535 | * | 536 | * |
536 | * Make sure you call e->ignore if you don't want to handle this event | 537 | * Make sure you call e->ignore if you don't want to handle this event |
537 | */ | 538 | */ |
538 | OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) { | 539 | OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) { |
539 | /* | 540 | /* |
540 | * Fix Up issues with Qt/E, my keybard, and virtual input | 541 | * Fix Up issues with Qt/E, my keybard, and virtual input |
541 | * methods | 542 | * methods |
542 | * First my Keyboard delivers 256,512,1024 for shift/ctrl/alt instead of the button state | 543 | * First my Keyboard delivers 256,512,1024 for shift/ctrl/alt instead of the button state |
543 | * Also key() on virtual inputmethods are zero and only ascii. We need to fix upper and lower | 544 | * Also key() on virtual inputmethods are zero and only ascii. We need to fix upper and lower |
544 | * case ascii | 545 | * case ascii |
545 | */ | 546 | */ |
546 | int key, mod; | 547 | int key, mod; |
547 | Opie::Ui::Private::fixupKeys( key, mod, e ); | 548 | Opie::Ui::Internal::fixupKeys( key, mod, e ); |
548 | 549 | ||
549 | OKeyConfigItem::List _keyList = keyList( key ); | 550 | OKeyConfigItem::List _keyList = keyList( key ); |
550 | if ( _keyList.isEmpty() ) | 551 | if ( _keyList.isEmpty() ) |
551 | return OKeyConfigItem(); | 552 | return OKeyConfigItem(); |
552 | 553 | ||
553 | OKeyConfigItem item; | 554 | OKeyConfigItem item; |
554 | for ( OKeyConfigItem::List::Iterator it = _keyList.begin(); it != _keyList.end(); | 555 | for ( OKeyConfigItem::List::Iterator it = _keyList.begin(); it != _keyList.end(); |
555 | ++it ) { | 556 | ++it ) { |
556 | if ( (*it).keyPair().modifier() == mod ) { | 557 | if ( (*it).keyPair().modifier() == mod ) { |
557 | item = *it; | 558 | item = *it; |
558 | break; | 559 | break; |
559 | } | 560 | } |
560 | 561 | ||
561 | } | 562 | } |
562 | 563 | ||
563 | return item; | 564 | return item; |
564 | } | 565 | } |
565 | 566 | ||
566 | /** | 567 | /** |
567 | * Return the associated id of the item or -1 if no item | 568 | * Return the associated id of the item or -1 if no item |
568 | * matched the key | 569 | * matched the key |
569 | * | 570 | * |
570 | * @see handleKeyEvent | 571 | * @see handleKeyEvent |
571 | */ | 572 | */ |
572 | int OKeyConfigManager::handleKeyEventId( QKeyEvent* ev) { | 573 | int OKeyConfigManager::handleKeyEventId( QKeyEvent* ev) { |
573 | return handleKeyEvent( ev ).id(); | 574 | return handleKeyEvent( ev ).id(); |
574 | } | 575 | } |
575 | 576 | ||
576 | /** | 577 | /** |
577 | * Add Key Config to the List of items | 578 | * Add Key Config to the List of items |
578 | */ | 579 | */ |
579 | void OKeyConfigManager::addKeyConfig( const OKeyConfigItem& item ) { | 580 | void OKeyConfigManager::addKeyConfig( const OKeyConfigItem& item ) { |
@@ -687,65 +688,65 @@ bool OKeyConfigManager::eventFilter( QObject* obj, QEvent* ev) { | |||
687 | OKeyConfigItem::List OKeyConfigManager::keyList( int keycode) { | 688 | OKeyConfigItem::List OKeyConfigManager::keyList( int keycode) { |
688 | /* | 689 | /* |
689 | * Create the map if not existing anymore | 690 | * Create the map if not existing anymore |
690 | */ | 691 | */ |
691 | if ( !m_map ) { | 692 | if ( !m_map ) { |
692 | m_map = new OKeyMapConfigPrivate; | 693 | m_map = new OKeyMapConfigPrivate; |
693 | /* for every key */ | 694 | /* for every key */ |
694 | for ( OKeyConfigItem::List::Iterator it = m_keys.begin(); | 695 | for ( OKeyConfigItem::List::Iterator it = m_keys.begin(); |
695 | it!= m_keys.end(); ++it ) { | 696 | it!= m_keys.end(); ++it ) { |
696 | 697 | ||
697 | bool add = true; | 698 | bool add = true; |
698 | /* see if this key is blocked */ | 699 | /* see if this key is blocked */ |
699 | OKeyPair pair = (*it).keyPair(); | 700 | OKeyPair pair = (*it).keyPair(); |
700 | for ( OKeyPair::List::Iterator pairIt = m_blackKeys.begin(); | 701 | for ( OKeyPair::List::Iterator pairIt = m_blackKeys.begin(); |
701 | pairIt != m_blackKeys.end(); ++pairIt ) { | 702 | pairIt != m_blackKeys.end(); ++pairIt ) { |
702 | if ( (*pairIt).keycode() == pair.keycode() && | 703 | if ( (*pairIt).keycode() == pair.keycode() && |
703 | (*pairIt).modifier() == pair.modifier() ) { | 704 | (*pairIt).modifier() == pair.modifier() ) { |
704 | add = false; | 705 | add = false; |
705 | break; | 706 | break; |
706 | } | 707 | } |
707 | } | 708 | } |
708 | /* check if we added it */ | 709 | /* check if we added it */ |
709 | if ( add ) | 710 | if ( add ) |
710 | (*m_map)[pair.keycode()].append( *it ); | 711 | (*m_map)[pair.keycode()].append( *it ); |
711 | } | 712 | } |
712 | } | 713 | } |
713 | return (*m_map)[keycode]; | 714 | return (*m_map)[keycode]; |
714 | } | 715 | } |
715 | 716 | ||
716 | 717 | ||
717 | namespace Opie { | 718 | namespace Opie { |
718 | namespace Ui { | 719 | namespace Ui { |
719 | namespace Private { | 720 | namespace Internal { |
720 | 721 | ||
721 | OKeyListViewItem::OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager* man, OListViewItem* parent) | 722 | OKeyListViewItem::OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager* man, OListViewItem* parent) |
722 | : Opie::Ui::OListViewItem( parent ), m_manager( man ) { | 723 | : Opie::Ui::OListViewItem( parent ), m_manager( man ) { |
723 | m_origItem = item; | 724 | m_origItem = item; |
724 | setItem( item ); | 725 | setItem( item ); |
725 | } | 726 | } |
726 | OKeyListViewItem::~OKeyListViewItem() {} | 727 | OKeyListViewItem::~OKeyListViewItem() {} |
727 | OKeyConfigItem &OKeyListViewItem::item(){ | 728 | OKeyConfigItem &OKeyListViewItem::item(){ |
728 | return m_item; | 729 | return m_item; |
729 | } | 730 | } |
730 | OKeyConfigItem OKeyListViewItem::origItem() const{ | 731 | OKeyConfigItem OKeyListViewItem::origItem() const{ |
731 | return m_origItem; | 732 | return m_origItem; |
732 | } | 733 | } |
733 | OKeyConfigManager* OKeyListViewItem::manager() { | 734 | OKeyConfigManager* OKeyListViewItem::manager() { |
734 | return m_manager; | 735 | return m_manager; |
735 | } | 736 | } |
736 | void OKeyListViewItem::setItem( const OKeyConfigItem& item ) { | 737 | void OKeyListViewItem::setItem( const OKeyConfigItem& item ) { |
737 | m_item = item; | 738 | m_item = item; |
738 | setPixmap( 0, m_item.pixmap() ); | 739 | setPixmap( 0, m_item.pixmap() ); |
739 | setText ( 1, m_item.text() ); | 740 | setText ( 1, m_item.text() ); |
740 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : | 741 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : |
741 | setText( 2, keyToString( m_item.keyPair() ) ); | 742 | setText( 2, keyToString( m_item.keyPair() ) ); |
742 | 743 | ||
743 | m_item.defaultKeyPair().isEmpty() ? setText( 3, QObject::tr( "None" ) ) : | 744 | m_item.defaultKeyPair().isEmpty() ? setText( 3, QObject::tr( "None" ) ) : |
744 | setText ( 3, keyToString( m_item.defaultKeyPair() ) ); | 745 | setText ( 3, keyToString( m_item.defaultKeyPair() ) ); |
745 | } | 746 | } |
746 | void OKeyListViewItem::updateText() { | 747 | void OKeyListViewItem::updateText() { |
747 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : | 748 | m_item.keyPair().isEmpty() ? setText( 2, QObject::tr( "None" ) ) : |
748 | setText( 2, keyToString( m_item.keyPair() ) ); | 749 | setText( 2, keyToString( m_item.keyPair() ) ); |
749 | } | 750 | } |
750 | 751 | ||
751 | QString keyToString( const OKeyPair& pair ) { | 752 | QString keyToString( const OKeyPair& pair ) { |
@@ -909,339 +910,339 @@ void OKeyConfigWidget::initUi() { | |||
909 | m_lbl= new QLabel( tr( "Default: " ), box ); | 910 | m_lbl= new QLabel( tr( "Default: " ), box ); |
910 | gridLay->addWidget( m_lbl, 2, 0 ); | 911 | gridLay->addWidget( m_lbl, 2, 0 ); |
911 | 912 | ||
912 | connect(m_btn, SIGNAL(clicked()), | 913 | connect(m_btn, SIGNAL(clicked()), |
913 | this, SLOT(slotConfigure())); | 914 | this, SLOT(slotConfigure())); |
914 | 915 | ||
915 | m_box = box; | 916 | m_box = box; |
916 | } | 917 | } |
917 | 918 | ||
918 | /** | 919 | /** |
919 | * Set the ChangeMode. | 920 | * Set the ChangeMode. |
920 | * You need to call this function prior to load | 921 | * You need to call this function prior to load |
921 | * If you call this function past load the behaviour is undefined | 922 | * If you call this function past load the behaviour is undefined |
922 | * But caling load again is safe | 923 | * But caling load again is safe |
923 | */ | 924 | */ |
924 | void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) { | 925 | void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) { |
925 | m_mode = mode; | 926 | m_mode = mode; |
926 | } | 927 | } |
927 | 928 | ||
928 | 929 | ||
929 | /** | 930 | /** |
930 | * return the current mode | 931 | * return the current mode |
931 | */ | 932 | */ |
932 | OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const { | 933 | OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const { |
933 | return m_mode; | 934 | return m_mode; |
934 | } | 935 | } |
935 | 936 | ||
936 | 937 | ||
937 | /** | 938 | /** |
938 | * insert these items before calling load | 939 | * insert these items before calling load |
939 | */ | 940 | */ |
940 | void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { | 941 | void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { |
941 | Opie::Ui::Private::OKeyConfigWidgetPrivate root( str, man ); | 942 | Opie::Ui::Internal::OKeyConfigWidgetPrivate root( str, man ); |
942 | m_list.append(root); | 943 | m_list.append(root); |
943 | } | 944 | } |
944 | 945 | ||
945 | 946 | ||
946 | /** | 947 | /** |
947 | * loads the items and allows editing them | 948 | * loads the items and allows editing them |
948 | */ | 949 | */ |
949 | void OKeyConfigWidget::load() { | 950 | void OKeyConfigWidget::load() { |
950 | Opie::Ui::Private::OKeyConfigWidgetPrivateList::Iterator it; | 951 | Opie::Ui::Internal::OKeyConfigWidgetPrivateList::Iterator it; |
951 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 952 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
952 | OListViewItem *item = new OListViewItem( m_view, (*it).name ); | 953 | OListViewItem *item = new OListViewItem( m_view, (*it).name ); |
953 | OKeyConfigItem::List list = (*it).manager->keyConfigList(); | 954 | OKeyConfigItem::List list = (*it).manager->keyConfigList(); |
954 | for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) | 955 | for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) |
955 | (void )new Opie::Ui::Private::OKeyListViewItem(*keyIt, (*it).manager, item ); | 956 | (void )new Opie::Ui::Internal::OKeyListViewItem(*keyIt, (*it).manager, item ); |
956 | 957 | ||
957 | } | 958 | } |
958 | } | 959 | } |
959 | 960 | ||
960 | /** | 961 | /** |
961 | * Saves if in Queue Mode. It'll update the supplied | 962 | * Saves if in Queue Mode. It'll update the supplied |
962 | * OKeyConfigManager objects. | 963 | * OKeyConfigManager objects. |
963 | * If in Queue mode it'll just return | 964 | * If in Queue mode it'll just return |
964 | */ | 965 | */ |
965 | void OKeyConfigWidget::save() { | 966 | void OKeyConfigWidget::save() { |
966 | /* | 967 | /* |
967 | * Iterate over all config items | 968 | * Iterate over all config items |
968 | */ | 969 | */ |
969 | QListViewItemIterator it( m_view ); | 970 | QListViewItemIterator it( m_view ); |
970 | while ( it.current() ) { | 971 | while ( it.current() ) { |
971 | if (it.current()->parent() ) { | 972 | if (it.current()->parent() ) { |
972 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( it.current() ); | 973 | Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( it.current() ); |
973 | OKeyConfigManager *man = item->manager(); | 974 | OKeyConfigManager *man = item->manager(); |
974 | man->removeKeyConfig( item->origItem() ); | 975 | man->removeKeyConfig( item->origItem() ); |
975 | man->addKeyConfig( item->item() ); | 976 | man->addKeyConfig( item->item() ); |
976 | } | 977 | } |
977 | ++it; | 978 | ++it; |
978 | } | 979 | } |
979 | 980 | ||
980 | 981 | ||
981 | } | 982 | } |
982 | 983 | ||
983 | 984 | ||
984 | /** | 985 | /** |
985 | * @internal | 986 | * @internal |
986 | */ | 987 | */ |
987 | void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) { | 988 | void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) { |
988 | if ( !_item || !_item->parent() ) { | 989 | if ( !_item || !_item->parent() ) { |
989 | m_box->setEnabled( false ); | 990 | m_box->setEnabled( false ); |
990 | m_none->setChecked( true ); | 991 | m_none->setChecked( true ); |
991 | m_btn ->setEnabled( false ); | 992 | m_btn ->setEnabled( false ); |
992 | m_def ->setChecked( false ); | 993 | m_def ->setChecked( false ); |
993 | m_cus ->setChecked( false ); | 994 | m_cus ->setChecked( false ); |
994 | }else{ | 995 | }else{ |
995 | m_box->setEnabled( true ); | 996 | m_box->setEnabled( true ); |
996 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( _item ); | 997 | Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( _item ); |
997 | OKeyConfigItem keyItem= item->item(); | 998 | OKeyConfigItem keyItem= item->item(); |
998 | m_lbl->setText( tr("Default: " )+ item->text( 3 ) ); | 999 | m_lbl->setText( tr("Default: " )+ item->text( 3 ) ); |
999 | if ( keyItem.keyPair().isEmpty() ) { | 1000 | if ( keyItem.keyPair().isEmpty() ) { |
1000 | m_none->setChecked( true ); | 1001 | m_none->setChecked( true ); |
1001 | m_btn ->setEnabled( false ); | 1002 | m_btn ->setEnabled( false ); |
1002 | m_def ->setChecked( false ); | 1003 | m_def ->setChecked( false ); |
1003 | m_cus ->setChecked( false ); | 1004 | m_cus ->setChecked( false ); |
1004 | }else { | 1005 | }else { |
1005 | m_none->setChecked( false ); | 1006 | m_none->setChecked( false ); |
1006 | m_cus ->setChecked( true ); | 1007 | m_cus ->setChecked( true ); |
1007 | m_btn ->setEnabled( true ); | 1008 | m_btn ->setEnabled( true ); |
1008 | m_def ->setChecked( false ); | 1009 | m_def ->setChecked( false ); |
1009 | } | 1010 | } |
1010 | } | 1011 | } |
1011 | } | 1012 | } |
1012 | 1013 | ||
1013 | void OKeyConfigWidget::slotNoKey() { | 1014 | void OKeyConfigWidget::slotNoKey() { |
1014 | m_none->setChecked( true ); | 1015 | m_none->setChecked( true ); |
1015 | m_cus ->setChecked( false ); | 1016 | m_cus ->setChecked( false ); |
1016 | m_btn ->setEnabled( false ); | 1017 | m_btn ->setEnabled( false ); |
1017 | m_def ->setChecked( false ); | 1018 | m_def ->setChecked( false ); |
1018 | 1019 | ||
1019 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1020 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1020 | return; | 1021 | return; |
1021 | 1022 | ||
1022 | 1023 | ||
1023 | 1024 | ||
1024 | /* | 1025 | /* |
1025 | * If immediate we need to remove and readd the key | 1026 | * If immediate we need to remove and readd the key |
1026 | */ | 1027 | */ |
1027 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); | 1028 | Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>(m_view->currentItem()); |
1028 | updateItem( item, OKeyPair::emptyKey() ); | 1029 | updateItem( item, OKeyPair::emptyKey() ); |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | void OKeyConfigWidget::slotDefaultKey() { | 1032 | void OKeyConfigWidget::slotDefaultKey() { |
1032 | m_none->setChecked( false ); | 1033 | m_none->setChecked( false ); |
1033 | m_cus ->setChecked( false ); | 1034 | m_cus ->setChecked( false ); |
1034 | m_btn ->setEnabled( false ); | 1035 | m_btn ->setEnabled( false ); |
1035 | m_def ->setChecked( true ); | 1036 | m_def ->setChecked( true ); |
1036 | 1037 | ||
1037 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1038 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1038 | return; | 1039 | return; |
1039 | 1040 | ||
1040 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); | 1041 | Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>(m_view->currentItem()); |
1041 | updateItem( item, item->item().defaultKeyPair() ); | 1042 | updateItem( item, item->item().defaultKeyPair() ); |
1042 | } | 1043 | } |
1043 | 1044 | ||
1044 | void OKeyConfigWidget::slotCustomKey() { | 1045 | void OKeyConfigWidget::slotCustomKey() { |
1045 | m_cus ->setChecked( true ); | 1046 | m_cus ->setChecked( true ); |
1046 | m_btn ->setEnabled( true ); | 1047 | m_btn ->setEnabled( true ); |
1047 | m_def ->setChecked( false ); | 1048 | m_def ->setChecked( false ); |
1048 | m_none->setChecked( false ); | 1049 | m_none->setChecked( false ); |
1049 | 1050 | ||
1050 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1051 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1051 | return; | 1052 | return; |
1052 | 1053 | ||
1053 | 1054 | ||
1054 | } | 1055 | } |
1055 | 1056 | ||
1056 | void OKeyConfigWidget::slotConfigure() { | 1057 | void OKeyConfigWidget::slotConfigure() { |
1057 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) | 1058 | if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) |
1058 | return; | 1059 | return; |
1059 | 1060 | ||
1060 | /* FIXME make use of OModalHelper */ | 1061 | /* FIXME make use of OModalHelper */ |
1061 | OKeyChooserConfigDialog dlg( this, "Dialog Name", true ); | 1062 | OKeyChooserConfigDialog dlg( this, "Dialog Name", true ); |
1062 | dlg.setCaption(tr("Configure Key")); | 1063 | dlg.setCaption(tr("Configure Key")); |
1063 | connect(&dlg, SIGNAL(keyCaptured()), &dlg, SLOT(accept()) ); | 1064 | connect(&dlg, SIGNAL(keyCaptured()), &dlg, SLOT(accept()) ); |
1064 | 1065 | ||
1065 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { | 1066 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { |
1066 | Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); | 1067 | Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>(m_view->currentItem()); |
1067 | updateItem( item, dlg.keyPair() ); | 1068 | updateItem( item, dlg.keyPair() ); |
1068 | } | 1069 | } |
1069 | 1070 | ||
1070 | 1071 | ||
1071 | } | 1072 | } |
1072 | 1073 | ||
1073 | bool OKeyConfigWidget::sanityCheck( Opie::Ui::Private::OKeyListViewItem* item, | 1074 | bool OKeyConfigWidget::sanityCheck( Opie::Ui::Internal::OKeyListViewItem* item, |
1074 | const OKeyPair& newItem ) { | 1075 | const OKeyPair& newItem ) { |
1075 | OKeyPair::List bList = item->manager()->blackList(); | 1076 | OKeyPair::List bList = item->manager()->blackList(); |
1076 | for ( OKeyPair::List::Iterator it = bList.begin(); it != bList.end(); ++it ) { | 1077 | for ( OKeyPair::List::Iterator it = bList.begin(); it != bList.end(); ++it ) { |
1077 | /* black list matched */ | 1078 | /* black list matched */ |
1078 | if ( *it == newItem ) { | 1079 | if ( *it == newItem ) { |
1079 | QMessageBox::warning( 0, tr("Key is on BlackList" ), | 1080 | QMessageBox::warning( 0, tr("Key is on BlackList" ), |
1080 | tr("<qt>The Key you choose is on the black list " | 1081 | tr("<qt>The Key you choose is on the black list " |
1081 | "and may not be used with this manager. Please " | 1082 | "and may not be used with this manager. Please " |
1082 | "use a different key.</qt>" ) ); | 1083 | "use a different key.</qt>" ) ); |
1083 | return false; | 1084 | return false; |
1084 | } | 1085 | } |
1085 | } | 1086 | } |
1086 | /* no we need to check the other items which is dog slow */ | 1087 | /* no we need to check the other items which is dog slow */ |
1087 | QListViewItemIterator it( item->parent() ); | 1088 | QListViewItemIterator it( item->parent() ); |
1088 | while ( it.current() ) { | 1089 | while ( it.current() ) { |
1089 | /* if not our parent and not us */ | 1090 | /* if not our parent and not us */ |
1090 | if (it.current()->parent() && it.current() != item) { | 1091 | if (it.current()->parent() && it.current() != item) { |
1091 | /* damn already given away*/ | 1092 | /* damn already given away*/ |
1092 | if ( newItem == static_cast<Opie::Ui::Private::OKeyListViewItem*>(it.current() )->item().keyPair() ) { | 1093 | if ( newItem == static_cast<Opie::Ui::Internal::OKeyListViewItem*>(it.current() )->item().keyPair() ) { |
1093 | QMessageBox::warning( 0, tr("Key is already assigned" ), | 1094 | QMessageBox::warning( 0, tr("Key is already assigned" ), |
1094 | tr("<qt>The Key you choose is already taken by " | 1095 | tr("<qt>The Key you choose is already taken by " |
1095 | "a different Item of your config. Please try" | 1096 | "a different Item of your config. Please try" |
1096 | "using a different key.</qt>" ) ); | 1097 | "using a different key.</qt>" ) ); |
1097 | return false; | 1098 | return false; |
1098 | } | 1099 | } |
1099 | } | 1100 | } |
1100 | ++it; | 1101 | ++it; |
1101 | } | 1102 | } |
1102 | 1103 | ||
1103 | return true; | 1104 | return true; |
1104 | } | 1105 | } |
1105 | 1106 | ||
1106 | void OKeyConfigWidget::updateItem( Opie::Ui::Private::OKeyListViewItem *item, | 1107 | void OKeyConfigWidget::updateItem( Opie::Ui::Internal::OKeyListViewItem *item, |
1107 | const OKeyPair& newItem) { | 1108 | const OKeyPair& newItem) { |
1108 | /* sanity check | 1109 | /* sanity check |
1109 | * check against the blacklist of the manager | 1110 | * check against the blacklist of the manager |
1110 | * check if another item uses this key which is o(n) at least | 1111 | * check if another item uses this key which is o(n) at least |
1111 | */ | 1112 | */ |
1112 | if ( !newItem.isEmpty() && !sanityCheck(item, newItem )) | 1113 | if ( !newItem.isEmpty() && !sanityCheck(item, newItem )) |
1113 | return; | 1114 | return; |
1114 | 1115 | ||
1115 | 1116 | ||
1116 | 1117 | ||
1117 | /* | 1118 | /* |
1118 | * If immediate we need to remove and readd the key | 1119 | * If immediate we need to remove and readd the key |
1119 | */ | 1120 | */ |
1120 | if ( m_mode == Imediate ) | 1121 | if ( m_mode == Imediate ) |
1121 | item->manager()->removeKeyConfig( item->item() ); | 1122 | item->manager()->removeKeyConfig( item->item() ); |
1122 | 1123 | ||
1123 | item->item().setKeyPair( newItem ); | 1124 | item->item().setKeyPair( newItem ); |
1124 | item->updateText(); | 1125 | item->updateText(); |
1125 | 1126 | ||
1126 | if ( m_mode == Imediate ) | 1127 | if ( m_mode == Imediate ) |
1127 | item->manager()->addKeyConfig( item->item() ); | 1128 | item->manager()->addKeyConfig( item->item() ); |
1128 | } | 1129 | } |
1129 | 1130 | ||
1130 | 1131 | ||
1131 | 1132 | ||
1132 | ///// | 1133 | ///// |
1133 | OKeyChooserConfigDialog::OKeyChooserConfigDialog( QWidget* par, const char* nam, | 1134 | OKeyChooserConfigDialog::OKeyChooserConfigDialog( QWidget* par, const char* nam, |
1134 | bool mod, WFlags fl ) | 1135 | bool mod, WFlags fl ) |
1135 | : QDialog( par, nam, mod, fl ), m_virtKey( false ), m_keyPair( OKeyPair::emptyKey() ) , | 1136 | : QDialog( par, nam, mod, fl ), m_virtKey( false ), m_keyPair( OKeyPair::emptyKey() ) , |
1136 | m_key( 0 ), m_mod( 0 ) { | 1137 | m_key( 0 ), m_mod( 0 ) { |
1137 | setFocusPolicy( StrongFocus ); | 1138 | setFocusPolicy( StrongFocus ); |
1138 | 1139 | ||
1139 | QHBoxLayout *lay = new QHBoxLayout( this ); | 1140 | QHBoxLayout *lay = new QHBoxLayout( this ); |
1140 | 1141 | ||
1141 | QLabel *lbl = new QLabel( tr("Configure Key" ), this ); | 1142 | QLabel *lbl = new QLabel( tr("Configure Key" ), this ); |
1142 | lay->addWidget( lbl ); | 1143 | lay->addWidget( lbl ); |
1143 | lbl->setFocusPolicy( NoFocus ); | 1144 | lbl->setFocusPolicy( NoFocus ); |
1144 | 1145 | ||
1145 | m_lbl = new QLabel( this ); | 1146 | m_lbl = new QLabel( this ); |
1146 | lay->addWidget( m_lbl ); | 1147 | lay->addWidget( m_lbl ); |
1147 | m_lbl->setFocusPolicy( NoFocus ); | 1148 | m_lbl->setFocusPolicy( NoFocus ); |
1148 | 1149 | ||
1149 | m_timer = new QTimer( this ); | 1150 | m_timer = new QTimer( this ); |
1150 | connect(m_timer, SIGNAL(timeout()), | 1151 | connect(m_timer, SIGNAL(timeout()), |
1151 | this, SLOT(slotTimeUp()) ); | 1152 | this, SLOT(slotTimeUp()) ); |
1152 | } | 1153 | } |
1153 | 1154 | ||
1154 | OKeyChooserConfigDialog::~OKeyChooserConfigDialog() { | 1155 | OKeyChooserConfigDialog::~OKeyChooserConfigDialog() { |
1155 | } | 1156 | } |
1156 | 1157 | ||
1157 | Opie::Ui::OKeyPair OKeyChooserConfigDialog::keyPair()const{ | 1158 | Opie::Ui::OKeyPair OKeyChooserConfigDialog::keyPair()const{ |
1158 | return m_keyPair; | 1159 | return m_keyPair; |
1159 | } | 1160 | } |
1160 | 1161 | ||
1161 | void OKeyChooserConfigDialog::keyPressEvent( QKeyEvent* ev ) { | 1162 | void OKeyChooserConfigDialog::keyPressEvent( QKeyEvent* ev ) { |
1162 | QDialog::keyPressEvent( ev ); | 1163 | QDialog::keyPressEvent( ev ); |
1163 | 1164 | ||
1164 | if ( ev->isAutoRepeat() ) | 1165 | if ( ev->isAutoRepeat() ) |
1165 | return; | 1166 | return; |
1166 | 1167 | ||
1167 | int mod, key; | 1168 | int mod, key; |
1168 | Opie::Ui::Private::fixupKeys( key,mod, ev ); | 1169 | Opie::Ui::Internal::fixupKeys( key,mod, ev ); |
1169 | 1170 | ||
1170 | /* either we used software keyboard | 1171 | /* either we used software keyboard |
1171 | * or we've true support | 1172 | * or we've true support |
1172 | */ | 1173 | */ |
1173 | if ( !m_virtKey && !ev->key()) { | 1174 | if ( !m_virtKey && !ev->key()) { |
1174 | m_virtKey = true; | 1175 | m_virtKey = true; |
1175 | m_keyPair = OKeyPair( key, mod ); | 1176 | m_keyPair = OKeyPair( key, mod ); |
1176 | }else{ | 1177 | }else{ |
1177 | mod = 0; | 1178 | mod = 0; |
1178 | switch( key ) { | 1179 | switch( key ) { |
1179 | case Qt::Key_Control: | 1180 | case Qt::Key_Control: |
1180 | mod = Qt::ControlButton; | 1181 | mod = Qt::ControlButton; |
1181 | break; | 1182 | break; |
1182 | case Qt::Key_Shift: | 1183 | case Qt::Key_Shift: |
1183 | mod = Qt::ShiftButton; | 1184 | mod = Qt::ShiftButton; |
1184 | break; | 1185 | break; |
1185 | case Qt::Key_Alt: | 1186 | case Qt::Key_Alt: |
1186 | mod = Qt::AltButton; | 1187 | mod = Qt::AltButton; |
1187 | break; | 1188 | break; |
1188 | default: | 1189 | default: |
1189 | break; | 1190 | break; |
1190 | } | 1191 | } |
1191 | if (mod ) { | 1192 | if (mod ) { |
1192 | m_mod |= mod; | 1193 | m_mod |= mod; |
1193 | key = 0; | 1194 | key = 0; |
1194 | }else | 1195 | }else |
1195 | m_key = key; | 1196 | m_key = key; |
1196 | 1197 | ||
1197 | if ( ( !mod || m_key || key ) && !m_timer->isActive() ) | 1198 | if ( ( !mod || m_key || key ) && !m_timer->isActive() ) |
1198 | m_timer->start( 150, true ); | 1199 | m_timer->start( 150, true ); |
1199 | 1200 | ||
1200 | m_keyPair = OKeyPair( m_key, m_mod ); | 1201 | m_keyPair = OKeyPair( m_key, m_mod ); |
1201 | } | 1202 | } |
1202 | 1203 | ||
1203 | m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); | 1204 | m_lbl->setText( Opie::Ui::Internal::keyToString( m_keyPair ) ); |
1204 | 1205 | ||
1205 | } | 1206 | } |
1206 | 1207 | ||
1207 | void OKeyChooserConfigDialog::keyReleaseEvent( QKeyEvent* ev ) { | 1208 | void OKeyChooserConfigDialog::keyReleaseEvent( QKeyEvent* ev ) { |
1208 | m_timer->stop(); | 1209 | m_timer->stop(); |
1209 | QDialog::keyPressEvent( ev ); | 1210 | QDialog::keyPressEvent( ev ); |
1210 | 1211 | ||
1211 | if ( ev->isAutoRepeat() ) | 1212 | if ( ev->isAutoRepeat() ) |
1212 | return; | 1213 | return; |
1213 | 1214 | ||
1214 | 1215 | ||
1215 | if ( m_virtKey && !ev->key()) { | 1216 | if ( m_virtKey && !ev->key()) { |
1216 | m_virtKey = false; | 1217 | m_virtKey = false; |
1217 | slotTimeUp(); | 1218 | slotTimeUp(); |
1218 | }else { | 1219 | }else { |
1219 | int mod = 0; | 1220 | int mod = 0; |
1220 | int key = ev->key(); | 1221 | int key = ev->key(); |
1221 | switch( key ) { | 1222 | switch( key ) { |
1222 | case Qt::Key_Control: | 1223 | case Qt::Key_Control: |
1223 | mod = Qt::ControlButton; | 1224 | mod = Qt::ControlButton; |
1224 | break; | 1225 | break; |
1225 | case Qt::Key_Shift: | 1226 | case Qt::Key_Shift: |
1226 | mod = Qt::ShiftButton; | 1227 | mod = Qt::ShiftButton; |
1227 | break; | 1228 | break; |
1228 | case Qt::Key_Alt: | 1229 | case Qt::Key_Alt: |
1229 | mod = Qt::AltButton; | 1230 | mod = Qt::AltButton; |
1230 | break; | 1231 | break; |
1231 | default: | 1232 | default: |
1232 | break; | 1233 | break; |
1233 | } | 1234 | } |
1234 | if (mod ) | 1235 | if (mod ) |
1235 | m_mod &= ~mod; | 1236 | m_mod &= ~mod; |
1236 | else | 1237 | else |
1237 | m_key = key; | 1238 | m_key = key; |
1238 | m_keyPair = OKeyPair( m_key, m_mod ); | 1239 | m_keyPair = OKeyPair( m_key, m_mod ); |
1239 | m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); | 1240 | m_lbl->setText( Opie::Ui::Internal::keyToString( m_keyPair ) ); |
1240 | } | 1241 | } |
1241 | } | 1242 | } |
1242 | 1243 | ||
1243 | 1244 | ||
1244 | void OKeyChooserConfigDialog::slotTimeUp() { | 1245 | void OKeyChooserConfigDialog::slotTimeUp() { |
1245 | m_mod = m_key = 0; | 1246 | m_mod = m_key = 0; |
1246 | QTimer::singleShot(0, this, SIGNAL(keyCaptured()) ); | 1247 | QTimer::singleShot(0, this, SIGNAL(keyCaptured()) ); |
1247 | } | 1248 | } |
diff --git a/libopie2/opieui/okeyconfigwidget.h b/libopie2/opieui/okeyconfigwidget.h index f75ed99..bb8eb6c 100644 --- a/libopie2/opieui/okeyconfigwidget.h +++ b/libopie2/opieui/okeyconfigwidget.h | |||
@@ -1,60 +1,60 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004 | 2 | * Copyright (C) 2004 |
3 | * LGPL v2 zecke@handhelds.org | 3 | * LGPL v2 zecke@handhelds.org |
4 | */ | 4 | */ |
5 | 5 | ||
6 | 6 | ||
7 | #ifndef ODP_KEY_CONFIG_WIDGET_H | 7 | #ifndef ODP_KEY_CONFIG_WIDGET_H |
8 | #define ODP_KEY_CONFIG_WIDGET_H | 8 | #define ODP_KEY_CONFIG_WIDGET_H |
9 | 9 | ||
10 | #include <opie2/oconfig.h> | 10 | #include <opie2/oconfig.h> |
11 | #include <opie2/odevice.h> | 11 | #include <opie2/odevice.h> |
12 | 12 | ||
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qpixmap.h> | 14 | #include <qpixmap.h> |
15 | #include <qcstring.h> | 15 | #include <qcstring.h> |
16 | #include <qhbox.h> | 16 | #include <qhbox.h> |
17 | #include <qvaluelist.h> | 17 | #include <qvaluelist.h> |
18 | 18 | ||
19 | class QKeyEvent; | 19 | class QKeyEvent; |
20 | class QLabel; | 20 | class QLabel; |
21 | class QPushButton; | 21 | class QPushButton; |
22 | class QListViewItem; | 22 | class QListViewItem; |
23 | class QRadioButton; | 23 | class QRadioButton; |
24 | class QTimer; | 24 | class QTimer; |
25 | 25 | ||
26 | namespace Opie { | 26 | namespace Opie { |
27 | namespace Ui { | 27 | namespace Ui { |
28 | namespace Private { | 28 | namespace Internal { |
29 | class OKeyConfigWidgetPrivate; | 29 | class OKeyConfigWidgetPrivate; |
30 | typedef QValueList<OKeyConfigWidgetPrivate> OKeyConfigWidgetPrivateList; | 30 | typedef QValueList<OKeyConfigWidgetPrivate> OKeyConfigWidgetPrivateList; |
31 | class OKeyListViewItem; | 31 | class OKeyListViewItem; |
32 | } | 32 | } |
33 | class OListViewItem; | 33 | class OListViewItem; |
34 | class OListView; | 34 | class OListView; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * \brief small class representing a Key with possible modifiers | 37 | * \brief small class representing a Key with possible modifiers |
38 | * This class holds information about key code and possible | 38 | * This class holds information about key code and possible |
39 | * modifier state. That is the lowest level of the key input | 39 | * modifier state. That is the lowest level of the key input |
40 | * functions. | 40 | * functions. |
41 | * There are also static methods to get special keys. | 41 | * There are also static methods to get special keys. |
42 | * OKeyPair will be used with \see OKeyConfigItem | 42 | * OKeyPair will be used with \see OKeyConfigItem |
43 | * | 43 | * |
44 | * @since 1.2 | 44 | * @since 1.2 |
45 | */ | 45 | */ |
46 | class OKeyPair { | 46 | class OKeyPair { |
47 | public: | 47 | public: |
48 | typedef QValueList<OKeyPair> List; | 48 | typedef QValueList<OKeyPair> List; |
49 | OKeyPair( int key = -1, int modifier = -1); | 49 | OKeyPair( int key = -1, int modifier = -1); |
50 | ~OKeyPair(); | 50 | ~OKeyPair(); |
51 | 51 | ||
52 | bool operator==( const OKeyPair& )const; | 52 | bool operator==( const OKeyPair& )const; |
53 | bool operator!=( const OKeyPair& )const; | 53 | bool operator!=( const OKeyPair& )const; |
54 | 54 | ||
55 | bool isEmpty()const; | 55 | bool isEmpty()const; |
56 | 56 | ||
57 | int keycode()const; | 57 | int keycode()const; |
58 | int modifier()const; | 58 | int modifier()const; |
59 | 59 | ||
60 | void setKeycode( int ); | 60 | void setKeycode( int ); |
@@ -224,71 +224,71 @@ private: | |||
224 | * it to the OKeyConfigManager | 224 | * it to the OKeyConfigManager |
225 | * | 225 | * |
226 | * @since 1.2 | 226 | * @since 1.2 |
227 | */ | 227 | */ |
228 | class OKeyConfigWidget : public QWidget { | 228 | class OKeyConfigWidget : public QWidget { |
229 | Q_OBJECT | 229 | Q_OBJECT |
230 | 230 | ||
231 | public: | 231 | public: |
232 | /** | 232 | /** |
233 | * Immediate Apply the change directly to the underlying OKeyConfigManager | 233 | * Immediate Apply the change directly to the underlying OKeyConfigManager |
234 | * Queue Save all items and then apply when you save() | 234 | * Queue Save all items and then apply when you save() |
235 | */ | 235 | */ |
236 | enum ChangeMode { Imediate, Queue }; | 236 | enum ChangeMode { Imediate, Queue }; |
237 | OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 237 | OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
238 | ~OKeyConfigWidget(); | 238 | ~OKeyConfigWidget(); |
239 | 239 | ||
240 | void setChangeMode( enum ChangeMode ); | 240 | void setChangeMode( enum ChangeMode ); |
241 | ChangeMode changeMode()const; | 241 | ChangeMode changeMode()const; |
242 | 242 | ||
243 | void insert( const QString& name, OKeyConfigManager* ); | 243 | void insert( const QString& name, OKeyConfigManager* ); |
244 | 244 | ||
245 | void load(); | 245 | void load(); |
246 | void save(); | 246 | void save(); |
247 | 247 | ||
248 | private slots: | 248 | private slots: |
249 | void slotListViewItem( QListViewItem* ); | 249 | void slotListViewItem( QListViewItem* ); |
250 | void slotNoKey(); | 250 | void slotNoKey(); |
251 | void slotDefaultKey(); | 251 | void slotDefaultKey(); |
252 | void slotCustomKey(); | 252 | void slotCustomKey(); |
253 | void slotConfigure(); | 253 | void slotConfigure(); |
254 | 254 | ||
255 | private: | 255 | private: |
256 | static bool sanityCheck( Opie::Ui::Private::OKeyListViewItem* man, | 256 | static bool sanityCheck( Opie::Ui::Internal::OKeyListViewItem* man, |
257 | const OKeyPair& newItem ); | 257 | const OKeyPair& newItem ); |
258 | void updateItem( Opie::Ui::Private::OKeyListViewItem* man, | 258 | void updateItem( Opie::Ui::Internal::OKeyListViewItem* man, |
259 | const OKeyPair& newItem); | 259 | const OKeyPair& newItem); |
260 | void initUi(); | 260 | void initUi(); |
261 | Opie::Ui::OListView *m_view; | 261 | Opie::Ui::OListView *m_view; |
262 | Opie::Ui::Private::OKeyConfigWidgetPrivateList m_list; | 262 | Opie::Ui::Internal::OKeyConfigWidgetPrivateList m_list; |
263 | QLabel *m_lbl; | 263 | QLabel *m_lbl; |
264 | QPushButton *m_btn; | 264 | QPushButton *m_btn; |
265 | QRadioButton *m_def, *m_cus, *m_none; | 265 | QRadioButton *m_def, *m_cus, *m_none; |
266 | QWidget* m_box; | 266 | QWidget* m_box; |
267 | ChangeMode m_mode; | 267 | ChangeMode m_mode; |
268 | class Private; | 268 | class Private; |
269 | Private *d; | 269 | Private *d; |
270 | }; | 270 | }; |
271 | 271 | ||
272 | 272 | ||
273 | /** | 273 | /** |
274 | * This is a small dialog that allows you to | 274 | * This is a small dialog that allows you to |
275 | * capture a key sequence. | 275 | * capture a key sequence. |
276 | * If you want it to close after a key was captured you | 276 | * If you want it to close after a key was captured you |
277 | * can use this code snippet. | 277 | * can use this code snippet. |
278 | * | 278 | * |
279 | * \code | 279 | * \code |
280 | * OKeyChooserConfigDialog diag(0,0,true); | 280 | * OKeyChooserConfigDialog diag(0,0,true); |
281 | * connect(&diag,SIGNAL(keyCaptured()), | 281 | * connect(&diag,SIGNAL(keyCaptured()), |
282 | * this,SLOT(accept())); | 282 | * this,SLOT(accept())); |
283 | * if( QPEApplication::execDialog(&diag) == QDialog::Accept ){ | 283 | * if( QPEApplication::execDialog(&diag) == QDialog::Accept ){ |
284 | * take_the_key_and_do_something | 284 | * take_the_key_and_do_something |
285 | * } | 285 | * } |
286 | * | 286 | * |
287 | * \endcode | 287 | * \endcode |
288 | * | 288 | * |
289 | */ | 289 | */ |
290 | class OKeyChooserConfigDialog : public QDialog { | 290 | class OKeyChooserConfigDialog : public QDialog { |
291 | Q_OBJECT | 291 | Q_OBJECT |
292 | public: | 292 | public: |
293 | OKeyChooserConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 293 | OKeyChooserConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); |
294 | ~OKeyChooserConfigDialog(); | 294 | ~OKeyChooserConfigDialog(); |
diff --git a/libopie2/opieui/okeyconfigwidget_p.h b/libopie2/opieui/okeyconfigwidget_p.h index e7eaba6..7690846 100644 --- a/libopie2/opieui/okeyconfigwidget_p.h +++ b/libopie2/opieui/okeyconfigwidget_p.h | |||
@@ -1,33 +1,33 @@ | |||
1 | /* | 1 | /* |
2 | * Only Internal implemented in the same .cpp file anyway | 2 | * Only Internal implemented in the same .cpp file anyway |
3 | */ | 3 | */ |
4 | #include <opie2/olistview.h> | 4 | #include <opie2/olistview.h> |
5 | 5 | ||
6 | 6 | ||
7 | namespace Opie { | 7 | namespace Opie { |
8 | namespace Ui { | 8 | namespace Ui { |
9 | namespace Private { | 9 | namespace Internal { |
10 | static QString keyToString( const OKeyPair& ); | 10 | static QString keyToString( const OKeyPair& ); |
11 | static void fixupKeys( int&, int&, QKeyEvent* ); | 11 | static void fixupKeys( int&, int&, QKeyEvent* ); |
12 | class OKeyListViewItem : public Opie::Ui::OListViewItem { | 12 | class OKeyListViewItem : public Opie::Ui::OListViewItem { |
13 | public: | 13 | public: |
14 | OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager*, Opie::Ui::OListViewItem* parent); | 14 | OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager*, Opie::Ui::OListViewItem* parent); |
15 | ~OKeyListViewItem(); | 15 | ~OKeyListViewItem(); |
16 | 16 | ||
17 | void setDefault(); | 17 | void setDefault(); |
18 | 18 | ||
19 | OKeyConfigItem& item(); | 19 | OKeyConfigItem& item(); |
20 | OKeyConfigItem origItem()const; | 20 | OKeyConfigItem origItem()const; |
21 | void setItem( const OKeyConfigItem& item ); | 21 | void setItem( const OKeyConfigItem& item ); |
22 | void updateText(); | 22 | void updateText(); |
23 | 23 | ||
24 | OKeyConfigManager *manager(); | 24 | OKeyConfigManager *manager(); |
25 | private: | 25 | private: |
26 | OKeyConfigItem m_item; | 26 | OKeyConfigItem m_item; |
27 | OKeyConfigItem m_origItem; | 27 | OKeyConfigItem m_origItem; |
28 | OKeyConfigManager* m_manager; | 28 | OKeyConfigManager* m_manager; |
29 | 29 | ||
30 | }; | 30 | }; |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } | 33 | } |
diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h index 0c85ee7..ec7b9c4 100644 --- a/libopie2/opieui/otaskbarapplet.h +++ b/libopie2/opieui/otaskbarapplet.h | |||
@@ -12,65 +12,65 @@ | |||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OTASKBARAPPLET_H | 32 | #ifndef OTASKBARAPPLET_H |
33 | #define OTASKBARAPPLET_H | 33 | #define OTASKBARAPPLET_H |
34 | 34 | ||
35 | #include <qpe/taskbarappletinterface.h> | 35 | #include <qpe/taskbarappletinterface.h> |
36 | #include <qpe/qcom.h> | 36 | #include <qpe/qcom.h> |
37 | 37 | ||
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | 39 | ||
40 | class QMouseEvent; | 40 | class QMouseEvent; |
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | namespace Ui { | 43 | namespace Ui { |
44 | namespace Private { | 44 | namespace Internal { |
45 | /*====================================================================================== | 45 | /*====================================================================================== |
46 | * OTaskbarAppletWrapper | 46 | * OTaskbarAppletWrapper |
47 | *======================================================================================*/ | 47 | *======================================================================================*/ |
48 | 48 | ||
49 | class OTaskbarAppletWrapperPrivate; | 49 | class OTaskbarAppletWrapperPrivate; |
50 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | 50 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface |
51 | { | 51 | { |
52 | public: | 52 | public: |
53 | OTaskbarAppletWrapper():_applet( 0 ) | 53 | OTaskbarAppletWrapper():_applet( 0 ) |
54 | { | 54 | { |
55 | } | 55 | } |
56 | 56 | ||
57 | virtual ~OTaskbarAppletWrapper() | 57 | virtual ~OTaskbarAppletWrapper() |
58 | { | 58 | { |
59 | delete _applet; | 59 | delete _applet; |
60 | } | 60 | } |
61 | 61 | ||
62 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) | 62 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) |
63 | { | 63 | { |
64 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); | 64 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); |
65 | *iface = 0; | 65 | *iface = 0; |
66 | if ( uuid == IID_QUnknown ) | 66 | if ( uuid == IID_QUnknown ) |
67 | *iface = this; | 67 | *iface = this; |
68 | else if ( uuid == IID_TaskbarApplet ) | 68 | else if ( uuid == IID_TaskbarApplet ) |
69 | *iface = this; | 69 | *iface = this; |
70 | else | 70 | else |
71 | return QS_FALSE; | 71 | return QS_FALSE; |
72 | 72 | ||
73 | if ( *iface ) (*iface)->addRef(); | 73 | if ( *iface ) (*iface)->addRef(); |
74 | return QS_OK; | 74 | return QS_OK; |
75 | } | 75 | } |
76 | 76 | ||
@@ -93,37 +93,37 @@ template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | |||
93 | }; | 93 | }; |
94 | 94 | ||
95 | } | 95 | } |
96 | /*====================================================================================== | 96 | /*====================================================================================== |
97 | * OTaskbarApplet | 97 | * OTaskbarApplet |
98 | *======================================================================================*/ | 98 | *======================================================================================*/ |
99 | 99 | ||
100 | // Must be inline until after we shipped Opie 1.0 | 100 | // Must be inline until after we shipped Opie 1.0 |
101 | 101 | ||
102 | // Having OTaskBarApplet reside in libopieui2 is not possible | 102 | // Having OTaskBarApplet reside in libopieui2 is not possible |
103 | // until we link the launcher binary against libopieui2 - | 103 | // until we link the launcher binary against libopieui2 - |
104 | // otherwise the necessary symbols are not present, when | 104 | // otherwise the necessary symbols are not present, when |
105 | // the dynamic loader [dlopen] tries to resolve an applet which | 105 | // the dynamic loader [dlopen] tries to resolve an applet which |
106 | // inherits OTaskbarApplet | 106 | // inherits OTaskbarApplet |
107 | 107 | ||
108 | class OTaskbarApplet : public QWidget | 108 | class OTaskbarApplet : public QWidget |
109 | { | 109 | { |
110 | public: | 110 | public: |
111 | OTaskbarApplet( QWidget* parent, const char* name = 0 ); | 111 | OTaskbarApplet( QWidget* parent, const char* name = 0 ); |
112 | virtual ~OTaskbarApplet(); | 112 | virtual ~OTaskbarApplet(); |
113 | 113 | ||
114 | protected: | 114 | protected: |
115 | virtual void popup( QWidget* widget ); | 115 | virtual void popup( QWidget* widget ); |
116 | private: | 116 | private: |
117 | class Private; | 117 | class Private; |
118 | Private *d; | 118 | Private *d; |
119 | }; | 119 | }; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | #define EXPORT_OPIE_APPLET_v1( AppLet ) \ | 123 | #define EXPORT_OPIE_APPLET_v1( AppLet ) \ |
124 | Q_EXPORT_INTERFACE() { \ | 124 | Q_EXPORT_INTERFACE() { \ |
125 | Q_CREATE_INSTANCE( Opie::Ui::Private::OTaskbarAppletWrapper<AppLet> ) \ | 125 | Q_CREATE_INSTANCE( Opie::Ui::Internal::OTaskbarAppletWrapper<AppLet> ) \ |
126 | } | 126 | } |
127 | 127 | ||
128 | #endif | 128 | #endif |
129 | 129 | ||