summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-04-24 05:48:32 (UTC)
committer mickeyl <mickeyl>2005-04-24 05:48:32 (UTC)
commitceaea9869115287b48781fabc938bd51cb67625c (patch) (unidiff)
tree4590e122439ac35ded56cad8b22f327d73e72844
parent07f375f59f19a001685db1b78e9ba9040c73bbeb (diff)
downloadopie-ceaea9869115287b48781fabc938bd51cb67625c.zip
opie-ceaea9869115287b48781fabc938bd51cb67625c.tar.gz
opie-ceaea9869115287b48781fabc938bd51cb67625c.tar.bz2
fix crash on kernels without swap support. patch courtesy Seneca Cunningham
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog3
-rw-r--r--noncore/applets/memoryapplet/swapfile.cpp8
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f2c8b4c..d2c386c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,65 +1,66 @@
1 2005-??-??Opie 1.2.1 1 2005-??-??Opie 1.2.1
2 2
3 3
4 New Features 4 New Features
5 ------------ 5 ------------
6 * OpieStumbler: New application (skyhusker) 6 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker)
7 7
8 Fixed Bugs 8 Fixed Bugs
9 ---------- 9 ----------
10 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) 10 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller)
11 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) 11 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller)
12 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) 12 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker)
13 * n.a.- always show volume and wireless applet popups inside visible screen (deller) 13 * n.a.- always show volume and wireless applet popups inside visible screen (deller)
14 * n.a. - scale O-Menu-Applets appropriately (mickeyl) 14 * n.a. - scale O-Menu-Applets appropriately (mickeyl)
15 * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) 15 * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker)
16 * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) 16 * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl)
17 * n.a.- scale BluezApplet appropriately (mickeyl) 17 * n.a.- scale BluezApplet appropriately (mickeyl)
18 * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham)
18 19
19 Internal 20 Internal
20 -------- 21 --------
21 * make BluezApplet use OTaskbarApplet (mickeyl) 22 * make BluezApplet use OTaskbarApplet (mickeyl)
22 23
23 2005-03-25Opie 1.2.0 24 2005-03-25Opie 1.2.0
24 25
25 Fixed Bugs 26 Fixed Bugs
26 ---------- 27 ----------
27 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) 28 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw)
28 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) 29 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin)
29 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) 30 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke)
30 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) 31 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw)
31 * n.a.- make qpeglobal.h include qglobal.h (zecke) 32 * n.a.- make qpeglobal.h include qglobal.h (zecke)
32 33
33 2005-03-20Opie 1.2.0-rc1 34 2005-03-20Opie 1.2.0-rc1
34 35
35 36
36 New Features 37 New Features
37 ------------ 38 ------------
38 * Launcher: Support a static background pixmap (mickeyl) 39 * Launcher: Support a static background pixmap (mickeyl)
39 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) 40 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
40 * PackageManager supports the 'lists_dir' ipkg configuration option (drw) 41 * PackageManager supports the 'lists_dir' ipkg configuration option (drw)
41 * Added hi-res inline images for large resolution devices (drw) 42 * Added hi-res inline images for large resolution devices (drw)
42 * Improved launcher icons for consistency (ar) 43 * Improved launcher icons for consistency (ar)
43 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) 44 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin)
44 45
45 Fixed Bugs 46 Fixed Bugs
46 ---------- 47 ----------
47 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) 48 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers)
48 * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) 49 * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw)
49 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) 50 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp)
50 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) 51 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke)
51 * #1482 - Fix double '/' in paths (zecke) 52 * #1482 - Fix double '/' in paths (zecke)
52 * #1536 - Autosave of custom locations in opie backup (ar) 53 * #1536 - Autosave of custom locations in opie backup (ar)
53 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) 54 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke)
54 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) 55 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke)
55 * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw) 56 * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw)
56 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) 57 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke)
57 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) 58 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl)
58 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) 59 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke)
59 * #1558 - Fixed opie-login breaking opie startup (mickeyl) 60 * #1558 - Fixed opie-login breaking opie startup (mickeyl)
60 * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning) 61 * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning)
61 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) 62 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar)
62 * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers) 63 * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers)
63 * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints) 64 * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints)
64 * #1604 - Checkbook crashed on startup (drw) 65 * #1604 - Checkbook crashed on startup (drw)
65 * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers) 66 * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers)
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp
index 4609c13..50c173b 100644
--- a/noncore/applets/memoryapplet/swapfile.cpp
+++ b/noncore/applets/memoryapplet/swapfile.cpp
@@ -1,106 +1,112 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (C) 2002-2005 the Opie Team <opie-devel@handhelds.org>
3** 4**
4** This file is part of Qtopia Environment. 5** This file is part of Opie Environment.
5** 6**
6** 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
7** 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
8** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 10** packaging of this file.
10** 11**
11** 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
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 14**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 16**
16** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 18** not clear to you.
18** 19**
19**********************************************************************/ 20**********************************************************************/
20 21
21#include "swapfile.h" 22#include "swapfile.h"
22 23
23/* OPIE */ 24/* OPIE */
24#include <opie2/odebug.h> 25#include <opie2/odebug.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
26using namespace Opie::Core; 27using namespace Opie::Core;
27 28
28/* QT */ 29/* QT */
29#include <qfile.h> 30#include <qfile.h>
30#include <qtextstream.h> 31#include <qtextstream.h>
31#include <qlabel.h> 32#include <qlabel.h>
32#include <qtimer.h> 33#include <qtimer.h>
33#include <qlayout.h> 34#include <qlayout.h>
34#include <qpushbutton.h> 35#include <qpushbutton.h>
35#include <qhbuttongroup.h> 36#include <qhbuttongroup.h>
36#include <qradiobutton.h> 37#include <qradiobutton.h>
37#include <qlineedit.h> 38#include <qlineedit.h>
38#include <qprogressbar.h> 39#include <qprogressbar.h>
39#include <qcombobox.h> 40#include <qcombobox.h>
40#include <qvgroupbox.h> 41#include <qvgroupbox.h>
41#include <qhbox.h> 42#include <qhbox.h>
42#include <qmessagebox.h> 43#include <qmessagebox.h>
43#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
44 45
45/* STD */ 46/* STD */
46#include <stdio.h> 47#include <stdio.h>
47#include <stdlib.h> 48#include <stdlib.h>
48#include <string.h> 49#include <string.h>
49#include <unistd.h> 50#include <unistd.h>
50#include <fcntl.h> 51#include <fcntl.h>
51#include <sys/vfs.h> 52#include <sys/vfs.h>
52#include <mntent.h> 53#include <mntent.h>
53#include <unistd.h> 54#include <unistd.h>
54#include <sys/types.h> 55#include <sys/types.h>
55 56
56Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) 57Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f )
57 : QWidget( parent, name, f ) 58 : QWidget( parent, name, f )
58{ 59{
60 if ( !QFile::exists( "/proc/swaps" ) )
61 {
62 QLabel *text = new QLabel( tr( "Swap disabled in kernel" ), this );
63 return;
64 }
59 // are we running as root? 65 // are we running as root?
60 isRoot = geteuid() == 0; 66 isRoot = geteuid() == 0;
61 67
62 QVBoxLayout* vb = new QVBoxLayout(this, 5); 68 QVBoxLayout* vb = new QVBoxLayout(this, 5);
63 69
64 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); 70 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this);
65 cfsdRBG->setRadioButtonExclusive(true); 71 cfsdRBG->setRadioButtonExclusive(true);
66 vb->addWidget(cfsdRBG); 72 vb->addWidget(cfsdRBG);
67 73
68 ramRB = new QRadioButton(tr("RAM"), cfsdRBG); 74 ramRB = new QRadioButton(tr("RAM"), cfsdRBG);
69 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); 75 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG);
70 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); 76 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG);
71 77
72 QHBox *hb1 = new QHBox(this); 78 QHBox *hb1 = new QHBox(this);
73 hb1->setSpacing(5); 79 hb1->setSpacing(5);
74 80
75 swapPath1 = new QLineEdit(hb1); 81 swapPath1 = new QLineEdit(hb1);
76 swapPath1->setEnabled(false); 82 swapPath1->setEnabled(false);
77 83
78 QPushButton* swapOn = new QPushButton(tr(" On "), hb1); 84 QPushButton* swapOn = new QPushButton(tr(" On "), hb1);
79 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); 85 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1);
80 vb->addWidget(hb1); 86 vb->addWidget(hb1);
81 87
82 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); 88 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this);
83 vb->addWidget(box1); 89 vb->addWidget(box1);
84 90
85 QHBox *hb2 = new QHBox(box1); 91 QHBox *hb2 = new QHBox(box1);
86 hb2->setSpacing(5); 92 hb2->setSpacing(5);
87 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); 93 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2);
88 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); 94 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2);
89 95
90 QHBox *hb3 = new QHBox(box1); 96 QHBox *hb3 = new QHBox(box1);
91 hb3->setSpacing(5); 97 hb3->setSpacing(5);
92 swapSize = new QComboBox(hb3); 98 swapSize = new QComboBox(hb3);
93 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb,16 Mb,32 Mb,64 Mb"))); 99 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb,16 Mb,32 Mb,64 Mb")));
94 100
95 mkswapProgress = new QProgressBar(3, hb3); 101 mkswapProgress = new QProgressBar(3, hb3);
96 mkswapProgress->setCenterIndicator(true); 102 mkswapProgress->setCenterIndicator(true);
97 103
98 QHBox *hb4 = new QHBox(this); 104 QHBox *hb4 = new QHBox(this);
99 hb4->setSpacing(5); 105 hb4->setSpacing(5);
100 106
101 swapStatusIcon = new QLabel(hb4); 107 swapStatusIcon = new QLabel(hb4);
102 swapStatus = new QLabel("", hb4); 108 swapStatus = new QLabel("", hb4);
103 hb4->setStretchFactor(swapStatus, 99); 109 hb4->setStretchFactor(swapStatus, 99);
104 vb->addWidget(hb4); 110 vb->addWidget(hb4);
105 111
106 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon())); 112 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon()));