author | drw <drw> | 2005-04-24 21:48:43 (UTC) |
---|---|---|
committer | drw <drw> | 2005-04-24 21:48:43 (UTC) |
commit | 40a0b1f81d5f53fede7831707d89a840d6691bd9 (patch) (unidiff) | |
tree | 9841e4cc54ef7e2347482a5219b3986940736c64 | |
parent | 2391cfd9c79b87b3b00a4bb4a1d76981debb4486 (diff) | |
download | opie-40a0b1f81d5f53fede7831707d89a840d6691bd9.zip opie-40a0b1f81d5f53fede7831707d89a840d6691bd9.tar.gz opie-40a0b1f81d5f53fede7831707d89a840d6691bd9.tar.bz2 |
Resource -> OResource
-rw-r--r-- | core/applets/clipboardapplet/clipboard.cpp | 14 | ||||
-rw-r--r-- | core/applets/clipboardapplet/clipboardapplet.pro | 2 | ||||
-rw-r--r-- | core/applets/clipboardapplet/opie-clipboardapplet.control | 2 | ||||
-rw-r--r-- | core/applets/logoutapplet/logout.cpp | 9 | ||||
-rw-r--r-- | core/applets/logoutapplet/logoutapplet.pro | 2 |
5 files changed, 12 insertions, 17 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index 57a4088..a32e98b 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp | |||
@@ -1,188 +1,186 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "clipboard.h" | 21 | #include "clipboard.h" |
22 | 22 | ||
23 | #include <opie2/otaskbarapplet.h> | 23 | #include <opie2/otaskbarapplet.h> |
24 | #include <qpe/resource.h> | 24 | #include <opie2/oresource.h> |
25 | |||
25 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
26 | 27 | ||
27 | #include <qpainter.h> | 28 | #include <qpainter.h> |
28 | #include <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
29 | #include <qwindowsystem_qws.h> | 30 | #include <qwindowsystem_qws.h> |
30 | #include <qapplication.h> | 31 | #include <qapplication.h> |
31 | #include <qclipboard.h> | 32 | #include <qclipboard.h> |
32 | #include <qtimer.h> | 33 | #include <qtimer.h> |
33 | 34 | ||
34 | //=========================================================================== | 35 | //=========================================================================== |
35 | 36 | ||
36 | 37 | ||
37 | using namespace Opie::Ui; | 38 | using namespace Opie::Ui; |
38 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) | 39 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) |
39 | { | 40 | { |
40 | setFixedWidth ( AppLnk::smallIconSize() ); | 41 | setFixedWidth ( AppLnk::smallIconSize() ); |
41 | setFixedHeight ( AppLnk::smallIconSize() ); | 42 | setFixedHeight ( AppLnk::smallIconSize() ); |
42 | 43 | ||
43 | QImage img = Resource::loadImage( "paste"); | 44 | m_clipboardPixmap = Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ); |
44 | img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | ||
45 | |||
46 | m_clipboardPixmap.convertFromImage( img ); | ||
47 | 45 | ||
48 | m_timer = new QTimer ( this ); | 46 | m_timer = new QTimer ( this ); |
49 | 47 | ||
50 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged()), this, SLOT( newData())); | 48 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged()), this, SLOT( newData())); |
51 | connect ( m_timer, SIGNAL( timeout()), this, SLOT( newData())); | 49 | connect ( m_timer, SIGNAL( timeout()), this, SLOT( newData())); |
52 | connect ( qApp, SIGNAL( aboutToQuit()), this, SLOT( shutdown())); | 50 | connect ( qApp, SIGNAL( aboutToQuit()), this, SLOT( shutdown())); |
53 | 51 | ||
54 | m_menu = 0; | 52 | m_menu = 0; |
55 | m_dirty = true; | 53 | m_dirty = true; |
56 | m_lasttext = QString::null; | 54 | m_lasttext = QString::null; |
57 | 55 | ||
58 | m_timer-> start ( 0, true ); | 56 | m_timer-> start ( 0, true ); |
59 | } | 57 | } |
60 | 58 | ||
61 | ClipboardApplet::~ClipboardApplet ( ) | 59 | ClipboardApplet::~ClipboardApplet ( ) |
62 | { | 60 | { |
63 | } | 61 | } |
64 | 62 | ||
65 | int ClipboardApplet::position() | 63 | int ClipboardApplet::position() |
66 | { | 64 | { |
67 | return 6; | 65 | return 6; |
68 | } | 66 | } |
69 | 67 | ||
70 | void ClipboardApplet::shutdown ( ) | 68 | void ClipboardApplet::shutdown ( ) |
71 | { | 69 | { |
72 | // the timer has to be stopped, or Qt/E will hang on quit() | 70 | // the timer has to be stopped, or Qt/E will hang on quit() |
73 | // see launcher/desktop.cpp | 71 | // see launcher/desktop.cpp |
74 | 72 | ||
75 | m_timer-> stop ( ); | 73 | m_timer-> stop ( ); |
76 | } | 74 | } |
77 | 75 | ||
78 | void ClipboardApplet::mousePressEvent ( QMouseEvent *) | 76 | void ClipboardApplet::mousePressEvent ( QMouseEvent *) |
79 | { | 77 | { |
80 | if ( m_dirty ) { | 78 | if ( m_dirty ) { |
81 | delete m_menu; | 79 | delete m_menu; |
82 | 80 | ||
83 | m_menu = new QPopupMenu ( this ); | 81 | m_menu = new QPopupMenu ( this ); |
84 | m_menu-> setCheckable ( true ); | 82 | m_menu-> setCheckable ( true ); |
85 | 83 | ||
86 | if ( m_history. count ( )) { | 84 | if ( m_history. count ( )) { |
87 | for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { | 85 | for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { |
88 | QString str = m_history [i]; | 86 | QString str = m_history [i]; |
89 | 87 | ||
90 | if ( str. length ( ) > 20 ) | 88 | if ( str. length ( ) > 20 ) |
91 | str = str. left ( 20 ) + "..."; | 89 | str = str. left ( 20 ) + "..."; |
92 | 90 | ||
93 | m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i ); | 91 | m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i ); |
94 | m_menu-> setItemChecked ( i, false ); | 92 | m_menu-> setItemChecked ( i, false ); |
95 | } | 93 | } |
96 | m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); | 94 | m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); |
97 | m_menu-> insertSeparator ( ); | 95 | m_menu-> insertSeparator ( ); |
98 | } | 96 | } |
99 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 ); | 97 | m_menu-> insertItem ( Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ), tr( "Cut" ), 100 ); |
100 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 ); | 98 | m_menu-> insertItem ( Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ), tr( "Copy" ), 101 ); |
101 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 ); | 99 | m_menu-> insertItem ( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), tr( "Paste" ), 102 ); |
102 | 100 | ||
103 | connect ( m_menu, SIGNAL( activated(int)), this, SLOT( action(int))); | 101 | connect ( m_menu, SIGNAL( activated(int)), this, SLOT( action(int))); |
104 | 102 | ||
105 | m_dirty = false; | 103 | m_dirty = false; |
106 | } | 104 | } |
107 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 105 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
108 | QSize s = m_menu-> sizeHint ( ); | 106 | QSize s = m_menu-> sizeHint ( ); |
109 | 107 | ||
110 | m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); | 108 | m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); |
111 | } | 109 | } |
112 | 110 | ||
113 | void ClipboardApplet::action(int id) | 111 | void ClipboardApplet::action(int id) |
114 | { | 112 | { |
115 | ushort unicode = 0; | 113 | ushort unicode = 0; |
116 | int scan = 0; | 114 | int scan = 0; |
117 | 115 | ||
118 | switch ( id ) { | 116 | switch ( id ) { |
119 | case 100: | 117 | case 100: |
120 | unicode = 'X' - '@'; | 118 | unicode = 'X' - '@'; |
121 | scan = Key_X; // Cut | 119 | scan = Key_X; // Cut |
122 | break; | 120 | break; |
123 | case 101: | 121 | case 101: |
124 | unicode = 'C' - '@'; | 122 | unicode = 'C' - '@'; |
125 | scan = Key_C; // Copy | 123 | scan = Key_C; // Copy |
126 | break; | 124 | break; |
127 | case 102: | 125 | case 102: |
128 | unicode = 'V' - '@'; | 126 | unicode = 'V' - '@'; |
129 | scan = Key_V; // Paste | 127 | scan = Key_V; // Paste |
130 | break; | 128 | break; |
131 | 129 | ||
132 | default: | 130 | default: |
133 | if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { | 131 | if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { |
134 | QApplication::clipboard ( )-> setText ( m_history [id] ); | 132 | QApplication::clipboard ( )-> setText ( m_history [id] ); |
135 | 133 | ||
136 | for ( uint i = 0; i < m_history. count ( ); i++ ) | 134 | for ( uint i = 0; i < m_history. count ( ); i++ ) |
137 | m_menu-> setItemChecked ( i, i == uint( id )); | 135 | m_menu-> setItemChecked ( i, i == uint( id )); |
138 | 136 | ||
139 | unicode = 'V' - '@'; | 137 | unicode = 'V' - '@'; |
140 | scan = Key_V; | 138 | scan = Key_V; |
141 | } | 139 | } |
142 | break; | 140 | break; |
143 | } | 141 | } |
144 | 142 | ||
145 | if ( scan ) { | 143 | if ( scan ) { |
146 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); | 144 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); |
147 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); | 145 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); |
148 | } | 146 | } |
149 | } | 147 | } |
150 | 148 | ||
151 | void ClipboardApplet::paintEvent ( QPaintEvent* ) | 149 | void ClipboardApplet::paintEvent ( QPaintEvent* ) |
152 | { | 150 | { |
153 | QPainter p ( this ); | 151 | QPainter p ( this ); |
154 | /* center the height but our pixmap is as big as the height ;)*/ | 152 | /* center the height but our pixmap is as big as the height ;)*/ |
155 | p. drawPixmap( 0, 0, | 153 | p. drawPixmap( 0, 0, |
156 | m_clipboardPixmap ); | 154 | m_clipboardPixmap ); |
157 | } | 155 | } |
158 | 156 | ||
159 | void ClipboardApplet::newData ( ) | 157 | void ClipboardApplet::newData ( ) |
160 | { | 158 | { |
161 | static bool excllock = false; | 159 | static bool excllock = false; |
162 | 160 | ||
163 | if ( excllock ) | 161 | if ( excllock ) |
164 | return; | 162 | return; |
165 | else | 163 | else |
166 | excllock = true; | 164 | excllock = true; |
167 | 165 | ||
168 | m_timer-> stop ( ); | 166 | m_timer-> stop ( ); |
169 | 167 | ||
170 | QCString type = "plain"; | 168 | QCString type = "plain"; |
171 | QString txt = QApplication::clipboard ( )-> text ( type ); | 169 | QString txt = QApplication::clipboard ( )-> text ( type ); |
172 | 170 | ||
173 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { | 171 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { |
174 | m_history. append ( txt ); | 172 | m_history. append ( txt ); |
175 | 173 | ||
176 | if ( m_history. count ( ) > 5 ) | 174 | if ( m_history. count ( ) > 5 ) |
177 | m_history. remove ( m_history. begin ( )); | 175 | m_history. remove ( m_history. begin ( )); |
178 | 176 | ||
179 | m_dirty = true; | 177 | m_dirty = true; |
180 | } | 178 | } |
181 | 179 | ||
182 | m_timer-> start ( 1500, true ); | 180 | m_timer-> start ( 1500, true ); |
183 | 181 | ||
184 | excllock = false; | 182 | excllock = false; |
185 | } | 183 | } |
186 | 184 | ||
187 | EXPORT_OPIE_APPLET_v1( ClipboardApplet ) | 185 | EXPORT_OPIE_APPLET_v1( ClipboardApplet ) |
188 | 186 | ||
diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro index 647598d..cdd0121 100644 --- a/core/applets/clipboardapplet/clipboardapplet.pro +++ b/core/applets/clipboardapplet/clipboardapplet.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | HEADERS = clipboard.h | 3 | HEADERS = clipboard.h |
4 | SOURCES = clipboard.cpp | 4 | SOURCES = clipboard.cpp |
5 | TARGET = clipboardapplet | 5 | TARGET = clipboardapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += | 8 | DEPENDPATH += |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include( $(OPIEDIR)/include.pro ) | 12 | include( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/clipboardapplet/opie-clipboardapplet.control b/core/applets/clipboardapplet/opie-clipboardapplet.control index e0e2d82..6596633 100644 --- a/core/applets/clipboardapplet/opie-clipboardapplet.control +++ b/core/applets/clipboardapplet/opie-clipboardapplet.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-clipboardapplet | 1 | Package: opie-clipboardapplet |
2 | Files: plugins/applets/libclipboardapplet.so* | 2 | Files: plugins/applets/libclipboardapplet.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: Robert Griebl <sandman@handhelds.org> | 5 | Maintainer: Robert Griebl <sandman@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2 |
8 | Description: Clipboard applet | 8 | Description: Clipboard applet |
9 | Clipboard applet for the Opie environment taskbar. | 9 | Clipboard applet for the Opie environment taskbar. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/applets/logoutapplet/logout.cpp b/core/applets/logoutapplet/logout.cpp index 0f36f16..dc0c67c 100644 --- a/core/applets/logoutapplet/logout.cpp +++ b/core/applets/logoutapplet/logout.cpp | |||
@@ -1,124 +1,121 @@ | |||
1 | #include "logout.h" | 1 | #include "logout.h" |
2 | 2 | ||
3 | #include <opie2/oresource.h> | ||
4 | |||
3 | #include <qpe/applnk.h> | 5 | #include <qpe/applnk.h> |
4 | #include <qpe/resource.h> | ||
5 | #include <qpe/qcopenvelope_qws.h> | 6 | #include <qpe/qcopenvelope_qws.h> |
6 | 7 | ||
7 | #include <qapplication.h> | 8 | #include <qapplication.h> |
8 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
9 | 10 | ||
10 | #include <unistd.h> | 11 | #include <unistd.h> |
11 | 12 | ||
12 | LogoutApplet::LogoutApplet ( ) | 13 | LogoutApplet::LogoutApplet ( ) |
13 | : QObject ( 0, "LogoutApplet" ) | 14 | : QObject ( 0, "LogoutApplet" ) |
14 | { | 15 | { |
15 | } | 16 | } |
16 | 17 | ||
17 | LogoutApplet::~LogoutApplet ( ) | 18 | LogoutApplet::~LogoutApplet ( ) |
18 | { | 19 | { |
19 | } | 20 | } |
20 | 21 | ||
21 | int LogoutApplet::position ( ) const | 22 | int LogoutApplet::position ( ) const |
22 | { | 23 | { |
23 | return 0; | 24 | return 0; |
24 | } | 25 | } |
25 | 26 | ||
26 | QString LogoutApplet::name ( ) const | 27 | QString LogoutApplet::name ( ) const |
27 | { | 28 | { |
28 | return tr( "Logout shortcut" ); | 29 | return tr( "Logout shortcut" ); |
29 | } | 30 | } |
30 | 31 | ||
31 | QString LogoutApplet::text ( ) const | 32 | QString LogoutApplet::text ( ) const |
32 | { | 33 | { |
33 | return tr( "Logout" ); | 34 | return tr( "Logout" ); |
34 | } | 35 | } |
35 | 36 | ||
36 | QString LogoutApplet::tr( const char* s ) const | 37 | QString LogoutApplet::tr( const char* s ) const |
37 | { | 38 | { |
38 | return qApp->translate( "LogoutApplet", s, 0 ); | 39 | return qApp->translate( "LogoutApplet", s, 0 ); |
39 | } | 40 | } |
40 | 41 | ||
41 | QString LogoutApplet::tr( const char* s, const char* p ) const | 42 | QString LogoutApplet::tr( const char* s, const char* p ) const |
42 | { | 43 | { |
43 | return qApp->translate( "LogoutApplet", s, p ); | 44 | return qApp->translate( "LogoutApplet", s, p ); |
44 | } | 45 | } |
45 | 46 | ||
46 | QIconSet LogoutApplet::icon ( ) const | 47 | QIconSet LogoutApplet::icon ( ) const |
47 | { | 48 | { |
48 | QPixmap pix; | 49 | QPixmap pix = Opie::Core::OResource::loadPixmap("logout", Opie::Core::OResource::SmallIcon ); |
49 | QImage img = Resource::loadImage ( "logout" ); | ||
50 | |||
51 | if ( !img. isNull ( )) | ||
52 | pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
53 | return pix; | 50 | return pix; |
54 | } | 51 | } |
55 | 52 | ||
56 | QPopupMenu *LogoutApplet::popup ( QWidget * ) const | 53 | QPopupMenu *LogoutApplet::popup ( QWidget * ) const |
57 | { | 54 | { |
58 | return 0; | 55 | return 0; |
59 | } | 56 | } |
60 | 57 | ||
61 | // This is a workaround for a Qt bug | 58 | // This is a workaround for a Qt bug |
62 | // clipboard applet has to stop its poll timer, or Qt/E | 59 | // clipboard applet has to stop its poll timer, or Qt/E |
63 | // will hang on quit() right before it emits aboutToQuit() | 60 | // will hang on quit() right before it emits aboutToQuit() |
64 | 61 | ||
65 | class HackApplication : public QApplication { | 62 | class HackApplication : public QApplication { |
66 | public: | 63 | public: |
67 | HackApplication ( ) : QApplication ( dummy, 0 ) | 64 | HackApplication ( ) : QApplication ( dummy, 0 ) |
68 | { | 65 | { |
69 | } | 66 | } |
70 | 67 | ||
71 | void emit_about_to_quit ( ) | 68 | void emit_about_to_quit ( ) |
72 | { | 69 | { |
73 | emit aboutToQuit ( ); | 70 | emit aboutToQuit ( ); |
74 | } | 71 | } |
75 | 72 | ||
76 | int dummy; | 73 | int dummy; |
77 | }; | 74 | }; |
78 | 75 | ||
79 | 76 | ||
80 | void LogoutApplet::activated ( ) | 77 | void LogoutApplet::activated ( ) |
81 | { | 78 | { |
82 | QMessageBox mb ( tr( "Logout" ), | 79 | QMessageBox mb ( tr( "Logout" ), |
83 | tr( "Do you really want to\nend this session ?" ), | 80 | tr( "Do you really want to\nend this session ?" ), |
84 | QMessageBox::NoIcon, | 81 | QMessageBox::NoIcon, |
85 | QMessageBox::Yes | QMessageBox::Default, | 82 | QMessageBox::Yes | QMessageBox::Default, |
86 | QMessageBox::No | QMessageBox::Escape, | 83 | QMessageBox::No | QMessageBox::Escape, |
87 | QMessageBox::NoButton ); | 84 | QMessageBox::NoButton ); |
88 | 85 | ||
89 | mb. setButtonText ( QMessageBox::Yes, "Yes" ); | 86 | mb. setButtonText ( QMessageBox::Yes, "Yes" ); |
90 | mb. setButtonText ( QMessageBox::No, "No" ); | 87 | mb. setButtonText ( QMessageBox::No, "No" ); |
91 | mb. setIconPixmap ( icon ( ). pixmap ( )); | 88 | mb. setIconPixmap ( icon ( ). pixmap ( )); |
92 | 89 | ||
93 | if ( mb. exec ( ) == QMessageBox::Yes ) { | 90 | if ( mb. exec ( ) == QMessageBox::Yes ) { |
94 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } | 91 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } |
95 | 92 | ||
96 | qApp-> processEvents ( ); // ensure the message goes out. | 93 | qApp-> processEvents ( ); // ensure the message goes out. |
97 | sleep ( 1 ); // You have 1 second to comply. | 94 | sleep ( 1 ); // You have 1 second to comply. |
98 | 95 | ||
99 | ((HackApplication *) qApp )-> emit_about_to_quit ( ); | 96 | ((HackApplication *) qApp )-> emit_about_to_quit ( ); |
100 | qApp-> quit(); | 97 | qApp-> quit(); |
101 | } | 98 | } |
102 | } | 99 | } |
103 | 100 | ||
104 | 101 | ||
105 | QRESULT LogoutApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 102 | QRESULT LogoutApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
106 | { | 103 | { |
107 | *iface = 0; | 104 | *iface = 0; |
108 | if ( uuid == IID_QUnknown ) | 105 | if ( uuid == IID_QUnknown ) |
109 | *iface = this; | 106 | *iface = this; |
110 | else if ( uuid == IID_MenuApplet ) | 107 | else if ( uuid == IID_MenuApplet ) |
111 | *iface = this; | 108 | *iface = this; |
112 | else | 109 | else |
113 | return QS_FALSE; | 110 | return QS_FALSE; |
114 | 111 | ||
115 | if ( *iface ) | 112 | if ( *iface ) |
116 | (*iface)-> addRef ( ); | 113 | (*iface)-> addRef ( ); |
117 | return QS_OK; | 114 | return QS_OK; |
118 | } | 115 | } |
119 | 116 | ||
120 | Q_EXPORT_INTERFACE( ) | 117 | Q_EXPORT_INTERFACE( ) |
121 | { | 118 | { |
122 | Q_CREATE_INSTANCE( LogoutApplet ) | 119 | Q_CREATE_INSTANCE( LogoutApplet ) |
123 | } | 120 | } |
124 | 121 | ||
diff --git a/core/applets/logoutapplet/logoutapplet.pro b/core/applets/logoutapplet/logoutapplet.pro index 23cab02..5bb1571 100644 --- a/core/applets/logoutapplet/logoutapplet.pro +++ b/core/applets/logoutapplet/logoutapplet.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | HEADERS = logout.h | 3 | HEADERS = logout.h |
4 | SOURCES = logout.cpp | 4 | SOURCES = logout.cpp |
5 | TARGET = logoutapplet | 5 | TARGET = logoutapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include( $(OPIEDIR)/include.pro ) | 12 | include( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |