author | mickeyl <mickeyl> | 2004-10-30 13:53:58 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-10-30 13:53:58 (UTC) |
commit | 0fc9ce0c22bad09470a18eb6d084c6042c914ed8 (patch) (unidiff) | |
tree | 99e8ac2db000ce606b497ded9146ddae691d27a7 | |
parent | 3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25 (diff) | |
download | opie-0fc9ce0c22bad09470a18eb6d084c6042c914ed8.zip opie-0fc9ce0c22bad09470a18eb6d084c6042c914ed8.tar.gz opie-0fc9ce0c22bad09470a18eb6d084c6042c914ed8.tar.bz2 |
remove hardcoded icon size here as well
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 25 |
2 files changed, 14 insertions, 12 deletions
@@ -1,130 +1,131 @@ | |||
1 | 2004-??-??Opie 1.1.x | 1 | 2004-??-??Opie 1.1.x |
2 | 2 | ||
3 | New Features | 3 | New Features |
4 | ------------ | 4 | ------------ |
5 | * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) | 5 | * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) |
6 | * Backup now uses the busy indicator when backing up and restore (ar) | 6 | * Backup now uses the busy indicator when backing up and restore (ar) |
7 | * OpiePlayer2 gained adding of Directories to the playlist (zecke) | 7 | * OpiePlayer2 gained adding of Directories to the playlist (zecke) |
8 | * OpiePlayer2 better error handling (zecke) | 8 | * OpiePlayer2 better error handling (zecke) |
9 | * OpiePlayer2 progress indication while streaming (zecke) | 9 | * OpiePlayer2 progress indication while streaming (zecke) |
10 | * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) | 10 | * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) |
11 | * Ported brightnessapplet from Qtopia 1.7 (mickeyl) | 11 | * Ported brightnessapplet from Qtopia 1.7 (mickeyl) |
12 | * Opie-Eye got a Digital Camera File Backend (alwin,zecke) | 12 | * Opie-Eye got a Digital Camera File Backend (alwin,zecke) |
13 | * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) | 13 | * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) |
14 | * Opie-Console use Custom Font and Size in a Profile (harlekin) | 14 | * Opie-Console use Custom Font and Size in a Profile (harlekin) |
15 | * Opie-Console transparently log the Output and Input to a file (harlekin) | 15 | * Opie-Console transparently log the Output and Input to a file (harlekin) |
16 | * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) | 16 | * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) |
17 | * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) | 17 | * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) |
18 | * Opie-Security gained a 'test authentication' button (clem) | 18 | * Opie-Security gained a 'test authentication' button (clem) |
19 | 19 | ||
20 | Fixed Bugs | 20 | Fixed Bugs |
21 | ---------- | 21 | ---------- |
22 | * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) | 22 | * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) |
23 | * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) | 23 | * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) |
24 | * #1245 - Opie-Go 'paused' (zecke) | 24 | * #1245 - Opie-Go 'paused' (zecke) |
25 | * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) | 25 | * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) |
26 | * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) | 26 | * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) |
27 | * #1395 - Build VNC Backend with gcc3.4 | 27 | * #1395 - Build VNC Backend with gcc3.4 |
28 | * #1440 - The icon of opie-mobilemsg is missing (CoreDump) | 28 | * #1440 - The icon of opie-mobilemsg is missing (CoreDump) |
29 | * #1445 - Opie-Sheet Has No Icon (CoreDump) | 29 | * #1445 - Opie-Sheet Has No Icon (CoreDump) |
30 | * #1448 - Brightness Applet added (mickeyl) | 30 | * #1448 - Brightness Applet added (mickeyl) |
31 | * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) | 31 | * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) |
32 | * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) | 32 | * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) |
33 | * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) | 33 | * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) |
34 | * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) | 34 | * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) |
35 | * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) | 35 | * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) |
36 | * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) | ||
36 | 37 | ||
37 | 2004-09-17Opie 1.1.6 | 38 | 2004-09-17Opie 1.1.6 |
38 | 39 | ||
39 | New Features | 40 | New Features |
40 | ------------ | 41 | ------------ |
41 | * Fifteen gained configurable number of items (zecke) | 42 | * Fifteen gained configurable number of items (zecke) |
42 | * Fifteen can have custom background images (zecke) | 43 | * Fifteen can have custom background images (zecke) |
43 | * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) | 44 | * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) |
44 | * Integrated the new security framework into libopie2 (zecke,clem) | 45 | * Integrated the new security framework into libopie2 (zecke,clem) |
45 | * Converted the launcher to use the new security framework (zecke) | 46 | * Converted the launcher to use the new security framework (zecke) |
46 | * Backup can now handle custom locations for backup and restore (ar) | 47 | * Backup can now handle custom locations for backup and restore (ar) |
47 | * Implemented right-on-hold feedback (wimpie,zecke) | 48 | * Implemented right-on-hold feedback (wimpie,zecke) |
48 | * Lots of new features in opie-reader (tim,pohly) | 49 | * Lots of new features in opie-reader (tim,pohly) |
49 | * Build system cleanups (schurig) | 50 | * Build system cleanups (schurig) |
50 | 51 | ||
51 | Fixed Bugs | 52 | Fixed Bugs |
52 | -------- | 53 | -------- |
53 | * #1005 - Fixed backup to CompactFlash (ar) | 54 | * #1005 - Fixed backup to CompactFlash (ar) |
54 | * #1167 - Fixed Opie write crashing on more text than one page (ar) | 55 | * #1167 - Fixed Opie write crashing on more text than one page (ar) |
55 | * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) | 56 | * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) |
56 | * #1359 - Fixed bookmarks in Gutenbrowser (ljp) | 57 | * #1359 - Fixed bookmarks in Gutenbrowser (ljp) |
57 | * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) | 58 | * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) |
58 | * #1370 - Pimconverter now reacts on cancel key (eilers) | 59 | * #1370 - Pimconverter now reacts on cancel key (eilers) |
59 | * #1376 - Bring back the capslock/numlock display (zecke) | 60 | * #1376 - Bring back the capslock/numlock display (zecke) |
60 | * #1383 - Language settings now warns about losing open apps (Markus Litz) | 61 | * #1383 - Language settings now warns about losing open apps (Markus Litz) |
61 | * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) | 62 | * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) |
62 | * #1394 - Fixed oversized headline in opie-login (coredump) | 63 | * #1394 - Fixed oversized headline in opie-login (coredump) |
63 | * #1396 - Opie-console captures the escape key and vim is working (zecke) | 64 | * #1396 - Opie-console captures the escape key and vim is working (zecke) |
64 | * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) | 65 | * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) |
65 | 66 | ||
66 | 2004-07-06Opie 1.1.4 | 67 | 2004-07-06Opie 1.1.4 |
67 | 68 | ||
68 | New Features | 69 | New Features |
69 | ------------ | 70 | ------------ |
70 | * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) | 71 | * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) |
71 | * Added Conversion tool for pim-data (eilers) | 72 | * Added Conversion tool for pim-data (eilers) |
72 | * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) | 73 | * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) |
73 | * Modified the PIM API for providing generic use of OPimRecords (eilers) | 74 | * Modified the PIM API for providing generic use of OPimRecords (eilers) |
74 | * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) | 75 | * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) |
75 | 76 | ||
76 | Fixed Bugs | 77 | Fixed Bugs |
77 | -------- | 78 | -------- |
78 | * #1068 - Country Drop Down Box Off Screen | 79 | * #1068 - Country Drop Down Box Off Screen |
79 | * #1291 - Opie tinykate does not open .desktop files (ar) | 80 | * #1291 - Opie tinykate does not open .desktop files (ar) |
80 | * #1291 - Opie sheet not saving correctly (ar) | 81 | * #1291 - Opie sheet not saving correctly (ar) |
81 | * #1294 - Opie does not know about British Summer Time | 82 | * #1294 - Opie does not know about British Summer Time |
82 | * #1314 - Drawpad initialization (mickeyl) | 83 | * #1314 - Drawpad initialization (mickeyl) |
83 | * #1317 - Packagemanager crashes on hold-down or install (chicken) | 84 | * #1317 - Packagemanager crashes on hold-down or install (chicken) |
84 | * #1321 - Batteryapplet graphic glitch (harlekin) | 85 | * #1321 - Batteryapplet graphic glitch (harlekin) |
85 | * #1324 - ZSafe not starting up (mickeyl) | 86 | * #1324 - ZSafe not starting up (mickeyl) |
86 | * #1328 - Personal Home Address fields is trimmed to 1char (eilers) | 87 | * #1328 - Personal Home Address fields is trimmed to 1char (eilers) |
87 | * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) | 88 | * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) |
88 | * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) | 89 | * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) |
89 | * #1348 - Datebook dependency on libopiedb2 (chicken) | 90 | * #1348 - Datebook dependency on libopiedb2 (chicken) |
90 | * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) | 91 | * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) |
91 | 92 | ||
92 | 2004-04-25Opie 1.1.3 | 93 | 2004-04-25Opie 1.1.3 |
93 | 94 | ||
94 | * Introduced first implementation of SQL-Support using SQLite (eilers) | 95 | * Introduced first implementation of SQL-Support using SQLite (eilers) |
95 | * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) | 96 | * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) |
96 | * Added a real system graffiti character set (brad) | 97 | * Added a real system graffiti character set (brad) |
97 | * Added Generic Keyconfig Widget (zecke) | 98 | * Added Generic Keyconfig Widget (zecke) |
98 | * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) | 99 | * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) |
99 | * Added new Bible reader app - opie-dagger (drw) | 100 | * Added new Bible reader app - opie-dagger (drw) |
100 | * Added a new Image Viewer. Work is ongoing (zecke,alwin) | 101 | * Added a new Image Viewer. Work is ongoing (zecke,alwin) |
101 | * Added namespace usage in libopie2 and everywhere (zecke,alwin) | 102 | * Added namespace usage in libopie2 and everywhere (zecke,alwin) |
102 | * Enabled the possibility to pass command line arguments to applications (mickeyl) | 103 | * Enabled the possibility to pass command line arguments to applications (mickeyl) |
103 | * Added an about applet showing some credits and information about Opie (mickeyl) | 104 | * Added an about applet showing some credits and information about Opie (mickeyl) |
104 | * Added benchmarking functionality to sysinfo (mickeyl) | 105 | * Added benchmarking functionality to sysinfo (mickeyl) |
105 | * Added applet and configuration application for switching hardware keyboard layouts (alwin) | 106 | * Added applet and configuration application for switching hardware keyboard layouts (alwin) |
106 | * Ported applications from libopie1 to libopie2* (drw,ar,alwin) | 107 | * Ported applications from libopie1 to libopie2* (drw,ar,alwin) |
107 | * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) | 108 | * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) |
108 | * Clean-up of package information in control files (drw) | 109 | * Clean-up of package information in control files (drw) |
109 | * Repaired mediummount which was broken since integrating the quicklauncher (alwin) | 110 | * Repaired mediummount which was broken since integrating the quicklauncher (alwin) |
110 | * Improved big-screen support (zecke,ar) | 111 | * Improved big-screen support (zecke,ar) |
111 | * Improved multikeyboard support, added keyboard layout switching applet (mouse) | 112 | * Improved multikeyboard support, added keyboard layout switching applet (mouse) |
112 | * Added a new mail client based on libetpan (harlekin,alwin,jgf) | 113 | * Added a new mail client based on libetpan (harlekin,alwin,jgf) |
113 | * Added new package manager - opie-packagemanager (drw) | 114 | * Added new package manager - opie-packagemanager (drw) |
114 | * Improved light-n-power for C7x0 (mickeyl) | 115 | * Improved light-n-power for C7x0 (mickeyl) |
115 | * Added automatic rotation support for C7x0 (treke) | 116 | * Added automatic rotation support for C7x0 (treke) |
116 | * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) | 117 | * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) |
117 | * Added scanning the wireless network neighbourhood to networksettings (mickeyl) | 118 | * Added scanning the wireless network neighbourhood to networksettings (mickeyl) |
118 | 119 | ||
119 | 2003-11-29Opie 1.0.3 | 120 | 2003-11-29Opie 1.0.3 |
120 | 121 | ||
121 | * Released as Version 1.0.3 | 122 | * Released as Version 1.0.3 |
122 | * Improved i18n (various contributors) | 123 | * Improved i18n (various contributors) |
123 | * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) | 124 | * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) |
124 | * Made the Documents Tab optional (mickeyl) | 125 | * Made the Documents Tab optional (mickeyl) |
125 | * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) | 126 | * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) |
126 | 127 | ||
127 | 2003-08-04Opie 1.0.0 | 128 | 2003-08-04Opie 1.0.0 |
128 | 129 | ||
129 | * Released as Version 1.0.0 | 130 | * Released as Version 1.0.0 |
130 | * Including a PPP module for easy dial up (tille,harlekin,zecke) | 131 | * Including a PPP module for easy dial up (tille,harlekin,zecke) |
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp index 267714e..6148308 100644 --- a/core/applets/irdaapplet/irda.cpp +++ b/core/applets/irdaapplet/irda.cpp | |||
@@ -1,363 +1,364 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org> | 2 | ** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org> |
3 | ** Max Reiss <harlekin@handhelds.org> [trivial stuff] | 3 | ** Max Reiss <harlekin@handhelds.org> [trivial stuff] |
4 | ** Robert Griebl <sandman@handhelds.org> | 4 | ** Robert Griebl <sandman@handhelds.org> |
5 | ** Holger Freyther <zecke@handhelds.org> QCOP Interface | 5 | ** Holger Freyther <zecke@handhelds.org> QCOP Interface |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | **********************************************************************/ | 15 | **********************************************************************/ |
16 | 16 | ||
17 | #include "irda.h" | 17 | #include "irda.h" |
18 | 18 | ||
19 | /* OPIE */ | 19 | /* OPIE */ |
20 | #include <opie2/otaskbarapplet.h> | 20 | #include <opie2/otaskbarapplet.h> |
21 | #include <qpe/applnk.h> | ||
21 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
24 | using namespace Opie::Ui; | ||
23 | 25 | ||
24 | /* QT */ | 26 | /* QT */ |
25 | #include <qpainter.h> | 27 | #include <qpainter.h> |
26 | #include <qfile.h> | 28 | #include <qfile.h> |
27 | #include <qtimer.h> | 29 | #include <qtimer.h> |
28 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
29 | 31 | ||
30 | /* STD */ | 32 | /* STD */ |
31 | #include <unistd.h> | 33 | #include <unistd.h> |
32 | #include <net/if.h> | 34 | #include <net/if.h> |
33 | #include <netinet/in.h> | 35 | #include <netinet/in.h> |
34 | #include <sys/types.h> | 36 | #include <sys/types.h> |
35 | #include <sys/socket.h> | 37 | #include <sys/socket.h> |
36 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
37 | 39 | ||
38 | //=========================================================================== | 40 | //=========================================================================== |
39 | 41 | ||
40 | using namespace Opie::Ui; | ||
41 | IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) | 42 | IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) |
42 | : QWidget ( parent, name ) | 43 | : QWidget ( parent, name ) |
43 | { | 44 | { |
44 | setFixedHeight ( 18 ); | 45 | setFixedHeight( AppLnk::smallIconSize() ); |
45 | setFixedWidth ( 14 ); | 46 | setFixedWidth( AppLnk::smallIconSize() ); |
46 | 47 | ||
47 | m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); | 48 | m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); |
48 | 49 | ||
49 | m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); | 50 | m_irdaOnPixmap = Resource::loadImage( "irdaapplet/irdaon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); |
50 | m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); | 51 | m_irdaOffPixmap = Resource::loadImage( "irdaapplet/irdaoff" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); |
51 | m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); | 52 | m_irdaDiscoveryOnPixmap = Resource::loadImage( "irdaapplet/magglass" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); |
52 | m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); | 53 | m_receiveActivePixmap = Resource::loadImage( "irdaapplet/receive" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); |
53 | 54 | ||
54 | m_irda_active = false; | 55 | m_irda_active = false; |
55 | m_irda_discovery_active = false; | 56 | m_irda_discovery_active = false; |
56 | m_receive_active = false; | 57 | m_receive_active = false; |
57 | m_receive_state_changed = false; | 58 | m_receive_state_changed = false; |
58 | m_popup = 0; | 59 | m_popup = 0; |
59 | m_wasOn = false; | 60 | m_wasOn = false; |
60 | m_wasDiscover = false; | 61 | m_wasDiscover = false; |
61 | 62 | ||
62 | QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); | 63 | QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); |
63 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), | 64 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), |
64 | this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); | 65 | this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); |
65 | } | 66 | } |
66 | 67 | ||
67 | int IrdaApplet::position() | 68 | int IrdaApplet::position() |
68 | { | 69 | { |
69 | return 6; | 70 | return 6; |
70 | } | 71 | } |
71 | 72 | ||
72 | void IrdaApplet::show() | 73 | void IrdaApplet::show() |
73 | { | 74 | { |
74 | QWidget::show ( ); | 75 | QWidget::show ( ); |
75 | startTimer ( 2000 ); | 76 | startTimer ( 2000 ); |
76 | } | 77 | } |
77 | 78 | ||
78 | IrdaApplet::~IrdaApplet() | 79 | IrdaApplet::~IrdaApplet() |
79 | { | 80 | { |
80 | if ( m_sockfd >= 0 ) | 81 | if ( m_sockfd >= 0 ) |
81 | ::close ( m_sockfd ); | 82 | ::close ( m_sockfd ); |
82 | } | 83 | } |
83 | 84 | ||
84 | void IrdaApplet::popup ( QString message, QString icon ) | 85 | void IrdaApplet::popup ( QString message, QString icon ) |
85 | { | 86 | { |
86 | if ( !m_popup ) | 87 | if ( !m_popup ) |
87 | m_popup = new QPopupMenu ( this ); | 88 | m_popup = new QPopupMenu ( this ); |
88 | 89 | ||
89 | m_popup-> clear ( ); | 90 | m_popup-> clear ( ); |
90 | 91 | ||
91 | if ( icon. isEmpty ( )) | 92 | if ( icon. isEmpty ( )) |
92 | m_popup-> insertItem ( message, 0 ); | 93 | m_popup-> insertItem ( message, 0 ); |
93 | else | 94 | else |
94 | m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); | 95 | m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); |
95 | 96 | ||
96 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 97 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
97 | QSize s = m_popup-> sizeHint ( ); | 98 | QSize s = m_popup-> sizeHint ( ); |
98 | m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), | 99 | m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), |
99 | p. y ( ) - s. height ( ))); | 100 | p. y ( ) - s. height ( ))); |
100 | 101 | ||
101 | QTimer::singleShot ( 2000, this, SLOT( popupTimeout())); | 102 | QTimer::singleShot ( 2000, this, SLOT( popupTimeout())); |
102 | } | 103 | } |
103 | 104 | ||
104 | void IrdaApplet::popupTimeout ( ) | 105 | void IrdaApplet::popupTimeout ( ) |
105 | { | 106 | { |
106 | m_popup-> hide ( ); | 107 | m_popup-> hide ( ); |
107 | } | 108 | } |
108 | 109 | ||
109 | bool IrdaApplet::checkIrdaStatus ( ) | 110 | bool IrdaApplet::checkIrdaStatus ( ) |
110 | { | 111 | { |
111 | struct ifreq ifr; | 112 | struct ifreq ifr; |
112 | strcpy ( ifr. ifr_name, "irda0" ); | 113 | strcpy ( ifr. ifr_name, "irda0" ); |
113 | 114 | ||
114 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) | 115 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) |
115 | return false; | 116 | return false; |
116 | 117 | ||
117 | return ( ifr. ifr_flags & IFF_UP ); | 118 | return ( ifr. ifr_flags & IFF_UP ); |
118 | } | 119 | } |
119 | 120 | ||
120 | bool IrdaApplet::setIrdaStatus ( bool b ) | 121 | bool IrdaApplet::setIrdaStatus ( bool b ) |
121 | { | 122 | { |
122 | struct ifreq ifr; | 123 | struct ifreq ifr; |
123 | strcpy ( ifr. ifr_name, "irda0" ); | 124 | strcpy ( ifr. ifr_name, "irda0" ); |
124 | 125 | ||
125 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) | 126 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) |
126 | return false; | 127 | return false; |
127 | 128 | ||
128 | if ( b ) { | 129 | if ( b ) { |
129 | ifr. ifr_flags |= IFF_UP; | 130 | ifr. ifr_flags |= IFF_UP; |
130 | } | 131 | } |
131 | else { | 132 | else { |
132 | setIrdaDiscoveryStatus ( 0 ); | 133 | setIrdaDiscoveryStatus ( 0 ); |
133 | setIrdaReceiveStatus ( 0 ); | 134 | setIrdaReceiveStatus ( 0 ); |
134 | ifr. ifr_flags &= ~IFF_UP; | 135 | ifr. ifr_flags &= ~IFF_UP; |
135 | } | 136 | } |
136 | 137 | ||
137 | if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) | 138 | if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) |
138 | return false; | 139 | return false; |
139 | 140 | ||
140 | return true; | 141 | return true; |
141 | } | 142 | } |
142 | 143 | ||
143 | bool IrdaApplet::checkIrdaDiscoveryStatus ( ) | 144 | bool IrdaApplet::checkIrdaDiscoveryStatus ( ) |
144 | { | 145 | { |
145 | QFile discovery ( "/proc/sys/net/irda/discovery" ); | 146 | QFile discovery ( "/proc/sys/net/irda/discovery" ); |
146 | 147 | ||
147 | QString streamIn = "0"; | 148 | QString streamIn = "0"; |
148 | 149 | ||
149 | if ( discovery. open ( IO_ReadOnly )) { | 150 | if ( discovery. open ( IO_ReadOnly )) { |
150 | QTextStream stream ( &discovery ); | 151 | QTextStream stream ( &discovery ); |
151 | streamIn = stream. read ( ); | 152 | streamIn = stream. read ( ); |
152 | } | 153 | } |
153 | 154 | ||
154 | return streamIn. toInt ( ) > 0; | 155 | return streamIn. toInt ( ) > 0; |
155 | } | 156 | } |
156 | 157 | ||
157 | 158 | ||
158 | bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) | 159 | bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) |
159 | { | 160 | { |
160 | QFile discovery ( "/proc/sys/net/irda/discovery" ); | 161 | QFile discovery ( "/proc/sys/net/irda/discovery" ); |
161 | 162 | ||
162 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { | 163 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { |
163 | discovery.putch ( d ? '1' : '0' ); | 164 | discovery.putch ( d ? '1' : '0' ); |
164 | return true; | 165 | return true; |
165 | } | 166 | } |
166 | return false; | 167 | return false; |
167 | } | 168 | } |
168 | 169 | ||
169 | 170 | ||
170 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) | 171 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) |
171 | { | 172 | { |
172 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); | 173 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); |
173 | e << ( d ? 1 : 0 ); | 174 | e << ( d ? 1 : 0 ); |
174 | 175 | ||
175 | m_receive_active = d; | 176 | m_receive_active = d; |
176 | m_receive_state_changed = true; | 177 | m_receive_state_changed = true; |
177 | 178 | ||
178 | return true; | 179 | return true; |
179 | } | 180 | } |
180 | 181 | ||
181 | 182 | ||
182 | void IrdaApplet::showDiscovered ( ) | 183 | void IrdaApplet::showDiscovered ( ) |
183 | { | 184 | { |
184 | //static Sound snd_found ( "irdaapplet/irdaon" ); | 185 | //static Sound snd_found ( "irdaapplet/irdaon" ); |
185 | //static Sound snd_lost ( "irdaapplet/irdaoff" ); | 186 | //static Sound snd_lost ( "irdaapplet/irdaoff" ); |
186 | 187 | ||
187 | QFile discovery ( "/proc/net/irda/discovery" ); | 188 | QFile discovery ( "/proc/net/irda/discovery" ); |
188 | 189 | ||
189 | if ( discovery. open ( IO_ReadOnly )) { | 190 | if ( discovery. open ( IO_ReadOnly )) { |
190 | bool qcopsend = false; | 191 | bool qcopsend = false; |
191 | 192 | ||
192 | QString discoveredDevice; | 193 | QString discoveredDevice; |
193 | QString deviceAddr; | 194 | QString deviceAddr; |
194 | 195 | ||
195 | // since it is /proc we _must_ use QTextStream | 196 | // since it is /proc we _must_ use QTextStream |
196 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); | 197 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); |
197 | 198 | ||
198 | QMap <QString, QString>::Iterator it; | 199 | QMap <QString, QString>::Iterator it; |
199 | 200 | ||
200 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) | 201 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) |
201 | it. data ( ). prepend ( "+++" ); | 202 | it. data ( ). prepend ( "+++" ); |
202 | 203 | ||
203 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { | 204 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { |
204 | const QString &line = *lit; | 205 | const QString &line = *lit; |
205 | 206 | ||
206 | if ( line. startsWith ( "nickname:" )) { | 207 | if ( line. startsWith ( "nickname:" )) { |
207 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); | 208 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); |
208 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); | 209 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); |
209 | 210 | ||
210 | // odebug << discoveredDevice + "(" + deviceAddr + ")" << oendl; | 211 | // odebug << discoveredDevice + "(" + deviceAddr + ")" << oendl; |
211 | 212 | ||
212 | if ( !m_devices. contains ( deviceAddr )) { | 213 | if ( !m_devices. contains ( deviceAddr )) { |
213 | popup ( tr( "Found:" ) + " " + discoveredDevice ); | 214 | popup ( tr( "Found:" ) + " " + discoveredDevice ); |
214 | //snd_found. play ( ); | 215 | //snd_found. play ( ); |
215 | qcopsend = true; | 216 | qcopsend = true; |
216 | } | 217 | } |
217 | m_devices. replace ( deviceAddr, discoveredDevice ); | 218 | m_devices. replace ( deviceAddr, discoveredDevice ); |
218 | } | 219 | } |
219 | } | 220 | } |
220 | 221 | ||
221 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { | 222 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { |
222 | // odebug << "IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?" << oendl; | 223 | // odebug << "IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?" << oendl; |
223 | 224 | ||
224 | if ( it. data ( ). left ( 3 ) == "+++" ) { | 225 | if ( it. data ( ). left ( 3 ) == "+++" ) { |
225 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); | 226 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); |
226 | //snd_lost. play ( ); | 227 | //snd_lost. play ( ); |
227 | 228 | ||
228 | QMap <QString, QString>::Iterator tmp = it; | 229 | QMap <QString, QString>::Iterator tmp = it; |
229 | tmp++; | 230 | tmp++; |
230 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator | 231 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator |
231 | it = tmp; | 232 | it = tmp; |
232 | 233 | ||
233 | qcopsend = true; | 234 | qcopsend = true; |
234 | } | 235 | } |
235 | else | 236 | else |
236 | it++; | 237 | it++; |
237 | } | 238 | } |
238 | // XXX if( qcopsend ) { | 239 | // XXX if( qcopsend ) { |
239 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); | 240 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); |
240 | e << ( m_devices. count ( ) > 0 ); | 241 | e << ( m_devices. count ( ) > 0 ); |
241 | // } | 242 | // } |
242 | } | 243 | } |
243 | } | 244 | } |
244 | 245 | ||
245 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) | 246 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) |
246 | { | 247 | { |
247 | QPopupMenu *menu = new QPopupMenu ( this ); | 248 | QPopupMenu *menu = new QPopupMenu ( this ); |
248 | QString cmd; | 249 | QString cmd; |
249 | 250 | ||
250 | /* Refresh active state */ | 251 | /* Refresh active state */ |
251 | timerEvent ( 0 ); | 252 | timerEvent ( 0 ); |
252 | 253 | ||
253 | //menu->insertItem( tr("More..."), 4 ); | 254 | //menu->insertItem( tr("More..."), 4 ); |
254 | 255 | ||
255 | if ( m_irda_active && !m_devices. isEmpty ( )) { | 256 | if ( m_irda_active && !m_devices. isEmpty ( )) { |
256 | menu-> insertItem ( tr( "Discovered Device:" ), 9 ); | 257 | menu-> insertItem ( tr( "Discovered Device:" ), 9 ); |
257 | 258 | ||
258 | for ( QMap<QString, QString>::Iterator it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) | 259 | for ( QMap<QString, QString>::Iterator it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) |
259 | menu-> insertItem ( *it ); | 260 | menu-> insertItem ( *it ); |
260 | 261 | ||
261 | menu-> insertSeparator ( ); | 262 | menu-> insertSeparator ( ); |
262 | } | 263 | } |
263 | 264 | ||
264 | menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 ); | 265 | menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 ); |
265 | 266 | ||
266 | if ( m_irda_active ) { | 267 | if ( m_irda_active ) { |
267 | menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 ); | 268 | menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 ); |
268 | menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 ); | 269 | menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 ); |
269 | } | 270 | } |
270 | 271 | ||
271 | QPoint p = mapToGlobal ( QPoint ( 0, 0 ) ); | 272 | QPoint p = mapToGlobal ( QPoint ( 0, 0 ) ); |
272 | QSize s = menu-> sizeHint ( ); | 273 | QSize s = menu-> sizeHint ( ); |
273 | 274 | ||
274 | p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )); | 275 | p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )); |
275 | 276 | ||
276 | switch ( menu-> exec ( p )) { | 277 | switch ( menu-> exec ( p )) { |
277 | case 0: | 278 | case 0: |
278 | setIrdaStatus ( !m_irda_active ); | 279 | setIrdaStatus ( !m_irda_active ); |
279 | timerEvent ( 0 ); | 280 | timerEvent ( 0 ); |
280 | break; | 281 | break; |
281 | case 1: | 282 | case 1: |
282 | setIrdaDiscoveryStatus ( !m_irda_discovery_active ); | 283 | setIrdaDiscoveryStatus ( !m_irda_discovery_active ); |
283 | timerEvent ( 0 ); | 284 | timerEvent ( 0 ); |
284 | break; | 285 | break; |
285 | case 2: | 286 | case 2: |
286 | setIrdaReceiveStatus ( !m_receive_active ); | 287 | setIrdaReceiveStatus ( !m_receive_active ); |
287 | timerEvent( 0 ); | 288 | timerEvent( 0 ); |
288 | break; | 289 | break; |
289 | } | 290 | } |
290 | 291 | ||
291 | delete menu; | 292 | delete menu; |
292 | } | 293 | } |
293 | 294 | ||
294 | void IrdaApplet::timerEvent ( QTimerEvent * ) | 295 | void IrdaApplet::timerEvent ( QTimerEvent * ) |
295 | { | 296 | { |
296 | bool oldactive = m_irda_active; | 297 | bool oldactive = m_irda_active; |
297 | bool olddiscovery = m_irda_discovery_active; | 298 | bool olddiscovery = m_irda_discovery_active; |
298 | bool receiveUpdate = false; | 299 | bool receiveUpdate = false; |
299 | 300 | ||
300 | if ( m_receive_state_changed ) { | 301 | if ( m_receive_state_changed ) { |
301 | receiveUpdate = true; | 302 | receiveUpdate = true; |
302 | m_receive_state_changed = false; | 303 | m_receive_state_changed = false; |
303 | } | 304 | } |
304 | 305 | ||
305 | m_irda_active = checkIrdaStatus ( ); | 306 | m_irda_active = checkIrdaStatus ( ); |
306 | m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); | 307 | m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); |
307 | 308 | ||
308 | if ( m_irda_discovery_active ) | 309 | if ( m_irda_discovery_active ) |
309 | showDiscovered ( ); | 310 | showDiscovered ( ); |
310 | 311 | ||
311 | if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) | 312 | if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) |
312 | update ( ); | 313 | update ( ); |
313 | } | 314 | } |
314 | 315 | ||
315 | void IrdaApplet::paintEvent ( QPaintEvent * ) | 316 | void IrdaApplet::paintEvent ( QPaintEvent * ) |
316 | { | 317 | { |
317 | QPainter p ( this ); | 318 | QPainter p( this ); |
318 | 319 | ||
319 | p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); | 320 | p.drawPixmap( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); |
320 | 321 | ||
321 | if ( m_irda_discovery_active ) | 322 | if ( m_irda_discovery_active ) |
322 | p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); | 323 | p.drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); |
323 | 324 | ||
324 | if ( m_receive_active ) | 325 | if ( m_receive_active ) |
325 | p. drawPixmap( 0, 1, m_receiveActivePixmap ); | 326 | p.drawPixmap( 0, 1, m_receiveActivePixmap ); |
326 | } | 327 | } |
327 | /* | 328 | /* |
328 | * We know 3 calls | 329 | * We know 3 calls |
329 | * a) enable | 330 | * a) enable |
330 | * b) disable | 331 | * b) disable |
331 | * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on | 332 | * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on |
332 | * c) listDevices: We will return a list of known devices | 333 | * c) listDevices: We will return a list of known devices |
333 | */ | 334 | */ |
334 | void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ) { | 335 | void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ) { |
335 | if ( str == "enableIrda()") { | 336 | if ( str == "enableIrda()") { |
336 | m_wasOn = checkIrdaStatus(); | 337 | m_wasOn = checkIrdaStatus(); |
337 | m_wasDiscover = checkIrdaDiscoveryStatus(); | 338 | m_wasDiscover = checkIrdaDiscoveryStatus(); |
338 | if (!m_wasOn) { | 339 | if (!m_wasOn) { |
339 | setIrdaStatus( true ); | 340 | setIrdaStatus( true ); |
340 | } | 341 | } |
341 | if ( !m_wasDiscover ) { | 342 | if ( !m_wasDiscover ) { |
342 | setIrdaDiscoveryStatus ( true ); | 343 | setIrdaDiscoveryStatus ( true ); |
343 | } | 344 | } |
344 | } else if ( str == "disableIrda()") { | 345 | } else if ( str == "disableIrda()") { |
345 | if (!m_wasOn) { | 346 | if (!m_wasOn) { |
346 | setIrdaStatus( false ); | 347 | setIrdaStatus( false ); |
347 | } | 348 | } |
348 | if ( !m_wasDiscover ) { | 349 | if ( !m_wasDiscover ) { |
349 | setIrdaDiscoveryStatus ( false ); | 350 | setIrdaDiscoveryStatus ( false ); |
350 | } | 351 | } |
351 | } else if ( str == "listDevices()") { | 352 | } else if ( str == "listDevices()") { |
352 | QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); | 353 | QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); |
353 | 354 | ||
354 | QStringList list; | 355 | QStringList list; |
355 | QMap<QString, QString>::Iterator it; | 356 | QMap<QString, QString>::Iterator it; |
356 | for (it = m_devices.begin(); it != m_devices.end(); ++it ) | 357 | for (it = m_devices.begin(); it != m_devices.end(); ++it ) |
357 | list << (*it); | 358 | list << (*it); |
358 | 359 | ||
359 | e << list; | 360 | e << list; |
360 | } | 361 | } |
361 | } | 362 | } |
362 | 363 | ||
363 | EXPORT_OPIE_APPLET_v1( IrdaApplet ) | 364 | EXPORT_OPIE_APPLET_v1( IrdaApplet ) |