summaryrefslogtreecommitdiff
authordrw <drw>2005-04-24 21:48:43 (UTC)
committer drw <drw>2005-04-24 21:48:43 (UTC)
commit40a0b1f81d5f53fede7831707d89a840d6691bd9 (patch) (unidiff)
tree9841e4cc54ef7e2347482a5219b3986940736c64
parent2391cfd9c79b87b3b00a4bb4a1d76981debb4486 (diff)
downloadopie-40a0b1f81d5f53fede7831707d89a840d6691bd9.zip
opie-40a0b1f81d5f53fede7831707d89a840d6691bd9.tar.gz
opie-40a0b1f81d5f53fede7831707d89a840d6691bd9.tar.bz2
Resource -> OResource
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp14
-rw-r--r--core/applets/clipboardapplet/clipboardapplet.pro2
-rw-r--r--core/applets/clipboardapplet/opie-clipboardapplet.control2
-rw-r--r--core/applets/logoutapplet/logout.cpp9
-rw-r--r--core/applets/logoutapplet/logoutapplet.pro2
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,70 +1,68 @@
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
37using namespace Opie::Ui; 38using namespace Opie::Ui;
38ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) 39ClipboardApplet::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
61ClipboardApplet::~ClipboardApplet ( ) 59ClipboardApplet::~ClipboardApplet ( )
62{ 60{
63} 61}
64 62
65int ClipboardApplet::position() 63int ClipboardApplet::position()
66{ 64{
67 return 6; 65 return 6;
68} 66}
69 67
70void ClipboardApplet::shutdown ( ) 68void ClipboardApplet::shutdown ( )
@@ -75,51 +73,51 @@ void ClipboardApplet::shutdown ( )
75 m_timer-> stop ( ); 73 m_timer-> stop ( );
76} 74}
77 75
78void ClipboardApplet::mousePressEvent ( QMouseEvent *) 76void 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
113void ClipboardApplet::action(int id) 111void 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
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
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += 8DEPENDPATH +=
9LIBS += -lqpe 9LIBS += -lqpe -lopiecore2
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12include( $(OPIEDIR)/include.pro ) 12include( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.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 @@
1Package: opie-clipboardapplet 1Package: opie-clipboardapplet
2Files: plugins/applets/libclipboardapplet.so* 2Files: plugins/applets/libclipboardapplet.so*
3Priority: optional 3Priority: optional
4Section: opie/applets 4Section: opie/applets
5Maintainer: Robert Griebl <sandman@handhelds.org> 5Maintainer: Robert Griebl <sandman@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal, libopiecore2
8Description: Clipboard applet 8Description: Clipboard applet
9 Clipboard applet for the Opie environment taskbar. 9 Clipboard applet for the Opie environment taskbar.
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $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,76 +1,73 @@
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
12LogoutApplet::LogoutApplet ( ) 13LogoutApplet::LogoutApplet ( )
13 : QObject ( 0, "LogoutApplet" ) 14 : QObject ( 0, "LogoutApplet" )
14{ 15{
15} 16}
16 17
17LogoutApplet::~LogoutApplet ( ) 18LogoutApplet::~LogoutApplet ( )
18{ 19{
19} 20}
20 21
21int LogoutApplet::position ( ) const 22int LogoutApplet::position ( ) const
22{ 23{
23 return 0; 24 return 0;
24} 25}
25 26
26QString LogoutApplet::name ( ) const 27QString LogoutApplet::name ( ) const
27{ 28{
28 return tr( "Logout shortcut" ); 29 return tr( "Logout shortcut" );
29} 30}
30 31
31QString LogoutApplet::text ( ) const 32QString LogoutApplet::text ( ) const
32{ 33{
33 return tr( "Logout" ); 34 return tr( "Logout" );
34} 35}
35 36
36QString LogoutApplet::tr( const char* s ) const 37QString 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
41QString LogoutApplet::tr( const char* s, const char* p ) const 42QString 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
46QIconSet LogoutApplet::icon ( ) const 47QIconSet 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
56QPopupMenu *LogoutApplet::popup ( QWidget * ) const 53QPopupMenu *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
65class HackApplication : public QApplication { 62class HackApplication : public QApplication {
66public: 63public:
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;
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 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on 2CONFIG += qt plugin warn_on
3HEADERS = logout.h 3HEADERS = logout.h
4SOURCES = logout.cpp 4SOURCES = logout.cpp
5TARGET = logoutapplet 5TARGET = logoutapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe -lopiecore2
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12include( $(OPIEDIR)/include.pro ) 12include( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets