summaryrefslogtreecommitdiff
path: root/noncore/applets/memoryapplet/swapfile.cpp
Side-by-side diff
Diffstat (limited to 'noncore/applets/memoryapplet/swapfile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/memoryapplet/swapfile.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp
index 9416db3..a71078f 100644
--- a/noncore/applets/memoryapplet/swapfile.cpp
+++ b/noncore/applets/memoryapplet/swapfile.cpp
@@ -1,102 +1,107 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "swapfile.h"
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/resource.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qfile.h>
#include <qtextstream.h>
#include <qlabel.h>
#include <qtimer.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qhbuttongroup.h>
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qprogressbar.h>
#include <qcombobox.h>
#include <qvgroupbox.h>
#include <qhbox.h>
#include <qmessagebox.h>
+#include <qcopchannel_qws.h>
+
+/* STD */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include <qcopchannel_qws.h>
-#include <qpe/resource.h>
-
#include <unistd.h>
#include <fcntl.h>
#include <sys/vfs.h>
#include <mntent.h>
#include <unistd.h>
#include <sys/types.h>
Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f )
: QWidget( parent, name, f )
{
// are we running as root?
isRoot = geteuid() == 0;
- QVBoxLayout* vb = new QVBoxLayout(this, 5);
+ QVBoxLayout* vb = new QVBoxLayout(this, 5);
QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this);
cfsdRBG->setRadioButtonExclusive(true);
- vb->addWidget(cfsdRBG);
+ vb->addWidget(cfsdRBG);
ramRB = new QRadioButton(tr("RAM"), cfsdRBG);
cfRB = new QRadioButton(tr("CF Card"), cfsdRBG);
sdRB = new QRadioButton(tr("SD Card"), cfsdRBG);
QHBox *hb1 = new QHBox(this);
hb1->setSpacing(5);
swapPath1 = new QLineEdit(hb1);
swapPath1->setEnabled(false);
QPushButton* swapOn = new QPushButton(tr(" On "), hb1);
QPushButton* swapOff = new QPushButton(tr(" Off "), hb1);
vb->addWidget(hb1);
QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this);
- vb->addWidget(box1);
+ vb->addWidget(box1);
QHBox *hb2 = new QHBox(box1);
hb2->setSpacing(5);
QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2);
QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2);
QHBox *hb3 = new QHBox(box1);
hb3->setSpacing(5);
swapSize = new QComboBox(hb3);
swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb")));
mkswapProgress = new QProgressBar(3, hb3);
mkswapProgress->setCenterIndicator(true);
QHBox *hb4 = new QHBox(this);
hb4->setSpacing(5);
swapStatusIcon = new QLabel(hb4);
swapStatus = new QLabel(tr(""), hb4);
hb4->setStretchFactor(swapStatus, 99);
vb->addWidget(hb4);
connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon()));
connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff()));
@@ -192,49 +197,49 @@ void Swapfile::getStatusPcmcia()
if (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1) {
QString text = QString::null;
QString what = QString::null;
if (cardWas0 != cardInPcmcia0) {
if (cardInPcmcia0) {
cfRB->setEnabled(TRUE);
} else {
cfRB->setChecked(FALSE);
cfRB->setEnabled(FALSE);
}
}
if (cardWas1 != cardInPcmcia1) {
if (cardInPcmcia1) {
cfRB->setEnabled(TRUE);
} else {
cfRB->setChecked(FALSE);
cfRB->setEnabled(FALSE);
}
}
}
} else {
// no file found
- qDebug("no file found");
+ odebug << "no file found" << oendl;
cardInPcmcia0 = FALSE;
cardInPcmcia1 = FALSE;
}
Swapfile::cfsdchecked();
}
void Swapfile::getStatusSd()
{
bool cardWas = cardInSd; // remember last state
cardInSd = FALSE;
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
struct mntent *me;
FILE *mntfp = setmntent("/etc/mtab", "r");
if (mntfp) {
while ((me = getmntent(mntfp)) != 0) {
QString fs = me->mnt_fsname;
if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd"
|| fs.left(9) == "/dev/mmcd") {
cardInSd = TRUE;
show();