-rw-r--r-- | noncore/applets/memoryapplet/swapfile.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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,16 +1,17 @@ | |||
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 |
@@ -47,24 +48,29 @@ using namespace Opie::Core; | |||
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 | ||
56 | Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) | 57 | Swapfile::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); |