-rw-r--r-- | examples/menuapplet/config.in | 2 | ||||
-rw-r--r-- | examples/menuapplet/example.cpp | 9 | ||||
-rw-r--r-- | examples/menuapplet/menuapplet.pro | 2 |
3 files changed, 4 insertions, 9 deletions
diff --git a/examples/menuapplet/config.in b/examples/menuapplet/config.in index 3167478..9425d9f 100644 --- a/examples/menuapplet/config.in +++ b/examples/menuapplet/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config EXAMPLE_MENU | 1 | config EXAMPLE_MENU |
2 | boolean "O-Menu Applet" | 2 | boolean "O-Menu Applet" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && EXAMPLES |
diff --git a/examples/menuapplet/example.cpp b/examples/menuapplet/example.cpp index 8ae77da..079030f 100644 --- a/examples/menuapplet/example.cpp +++ b/examples/menuapplet/example.cpp | |||
@@ -1,78 +1,73 @@ | |||
1 | #include "example.h" | 1 | #include "example.h" |
2 | 2 | ||
3 | #include <qpe/applnk.h> | 3 | #include <opie2/oresource.h> |
4 | #include <qpe/resource.h> | ||
5 | 4 | ||
6 | /* QT */ | 5 | /* QT */ |
7 | #include <qiconset.h> | 6 | #include <qiconset.h> |
8 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
9 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
10 | 9 | ||
11 | 10 | ||
12 | MenuAppletExample::MenuAppletExample() | 11 | MenuAppletExample::MenuAppletExample() |
13 | :QObject( 0, "MenuAppletExample" ) | 12 | :QObject( 0, "MenuAppletExample" ) |
14 | { | 13 | { |
15 | } | 14 | } |
16 | 15 | ||
17 | MenuAppletExample::~MenuAppletExample ( ) | 16 | MenuAppletExample::~MenuAppletExample ( ) |
18 | {} | 17 | {} |
19 | 18 | ||
20 | int MenuAppletExample::position() const | 19 | int MenuAppletExample::position() const |
21 | { | 20 | { |
22 | return 3; | 21 | return 3; |
23 | } | 22 | } |
24 | 23 | ||
25 | QString MenuAppletExample::name() const | 24 | QString MenuAppletExample::name() const |
26 | { | 25 | { |
27 | return tr( "MenuApplet Example Name" ); | 26 | return tr( "MenuApplet Example Name" ); |
28 | } | 27 | } |
29 | 28 | ||
30 | QString MenuAppletExample::text() const | 29 | QString MenuAppletExample::text() const |
31 | { | 30 | { |
32 | return tr( "Click the white rabbit" ); | 31 | return tr( "Click the white rabbit" ); |
33 | } | 32 | } |
34 | 33 | ||
35 | 34 | ||
36 | QIconSet MenuAppletExample::icon() const | 35 | QIconSet MenuAppletExample::icon() const |
37 | { | 36 | { |
38 | QPixmap pix; | 37 | return Opie::Core::OResource::loadPixmap( "Tux", Opie::Core::OResource::SmallIcon ); |
39 | QImage img = Resource::loadImage( "Tux" ); | ||
40 | if ( !img.isNull() ) | ||
41 | pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
42 | return pix; | ||
43 | } | 38 | } |
44 | 39 | ||
45 | QPopupMenu* MenuAppletExample::popup(QWidget*) const | 40 | QPopupMenu* MenuAppletExample::popup(QWidget*) const |
46 | { | 41 | { |
47 | /* no subdir */ | 42 | /* no subdir */ |
48 | return 0; | 43 | return 0; |
49 | } | 44 | } |
50 | 45 | ||
51 | void MenuAppletExample::activated() | 46 | void MenuAppletExample::activated() |
52 | { | 47 | { |
53 | QMessageBox::information(0,tr("No white rabbit found"), | 48 | QMessageBox::information(0,tr("No white rabbit found"), |
54 | tr("<qt>No white rabbit was seen near Opie." | 49 | tr("<qt>No white rabbit was seen near Opie." |
55 | "Only the beautiful OpieZilla is available" | 50 | "Only the beautiful OpieZilla is available" |
56 | "for your pleassure</qt>")); | 51 | "for your pleassure</qt>")); |
57 | } | 52 | } |
58 | 53 | ||
59 | 54 | ||
60 | QRESULT MenuAppletExample::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 55 | QRESULT MenuAppletExample::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
61 | { | 56 | { |
62 | *iface = 0; | 57 | *iface = 0; |
63 | if ( uuid == IID_QUnknown ) | 58 | if ( uuid == IID_QUnknown ) |
64 | *iface = this; | 59 | *iface = this; |
65 | else if ( uuid == IID_MenuApplet ) | 60 | else if ( uuid == IID_MenuApplet ) |
66 | *iface = this; | 61 | *iface = this; |
67 | else | 62 | else |
68 | return QS_FALSE; | 63 | return QS_FALSE; |
69 | 64 | ||
70 | if ( *iface ) | 65 | if ( *iface ) |
71 | (*iface)->addRef(); | 66 | (*iface)->addRef(); |
72 | return QS_OK; | 67 | return QS_OK; |
73 | } | 68 | } |
74 | 69 | ||
75 | Q_EXPORT_INTERFACE() | 70 | Q_EXPORT_INTERFACE() |
76 | { | 71 | { |
77 | Q_CREATE_INSTANCE( MenuAppletExample ) | 72 | Q_CREATE_INSTANCE( MenuAppletExample ) |
78 | } | 73 | } |
diff --git a/examples/menuapplet/menuapplet.pro b/examples/menuapplet/menuapplet.pro index 1e20e78..e8858ec 100644 --- a/examples/menuapplet/menuapplet.pro +++ b/examples/menuapplet/menuapplet.pro | |||
@@ -1,12 +1,12 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugn warn_on | 2 | CONFIG += qt plugn warn_on |
3 | HEADERS = example.h | 3 | HEADERS = example.h |
4 | SOURCES = example.cpp | 4 | SOURCES = example.cpp |
5 | TARGET = example_applet | 5 | TARGET = example_applet |
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 ) |