-rw-r--r-- | noncore/applets/memoryapplet/swapfile.cpp | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp index 7483592..04da8bb 100644 --- a/noncore/applets/memoryapplet/swapfile.cpp +++ b/noncore/applets/memoryapplet/swapfile.cpp @@ -22,2 +22,4 @@ +#include <qfile.h> +#include <qtextstream.h> #include <qlabel.h> @@ -26,9 +28,9 @@ #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 <qhbuttongroup.h> +#include <qradiobutton.h> +#include <qlineedit.h> +#include <qprogressbar.h> +#include <qcombobox.h> +#include <qvgroupbox.h> +#include <qhbox.h> #include <qmessagebox.h> @@ -45,4 +47,4 @@ #include <mntent.h> -#include <unistd.h>
-#include <sys/types.h>
+#include <unistd.h> +#include <sys/types.h> @@ -59,3 +61,3 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) vb->addWidget(cfsdRBG); - + ramRB = new QRadioButton(tr("RAM"), cfsdRBG); @@ -108,3 +110,3 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) sdRB->setEnabled(FALSE); - + QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); @@ -113,3 +115,3 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) connect(sdChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); - + cardInPcmcia0 = FALSE; @@ -135,7 +137,7 @@ void Swapfile::cardnotify(const QCString & msg, const QByteArray &) { - if (msg == "stabChanged()") + if (msg == "stabChanged()") { getStatusPcmcia(); - } - else if (msg == "mtabChanged()") + } + else if (msg == "mtabChanged()") { @@ -195,6 +197,6 @@ void Swapfile::getStatusPcmcia() if (cardInPcmcia0) { - cfRB->setEnabled(TRUE); + cfRB->setEnabled(TRUE); } else { cfRB->setChecked(FALSE); - cfRB->setEnabled(FALSE); + cfRB->setEnabled(FALSE); } @@ -204,6 +206,6 @@ void Swapfile::getStatusPcmcia() if (cardInPcmcia1) { - cfRB->setEnabled(TRUE); + cfRB->setEnabled(TRUE); } else { cfRB->setChecked(FALSE); - cfRB->setEnabled(FALSE); + cfRB->setEnabled(FALSE); } @@ -247,6 +249,6 @@ void Swapfile::getStatusSd() if (cardInSd) { - sdRB->setEnabled(TRUE); + sdRB->setEnabled(TRUE); } else { sdRB->setChecked(FALSE); - sdRB->setEnabled(FALSE); + sdRB->setEnabled(FALSE); } @@ -289,3 +291,3 @@ void Swapfile::swapoff() char swapcmd[128] ="swapoff "; - if (Swapfile::cfRB->isChecked() == TRUE) + if (Swapfile::cfRB->isChecked() == TRUE) Swapfile::cfsdchecked(); @@ -309,3 +311,3 @@ void Swapfile::cfsdchecked() Swapfile::swapPath1->clear(); - if (Swapfile::ramRB->isChecked() == TRUE) + if (Swapfile::ramRB->isChecked() == TRUE) { @@ -325,6 +327,6 @@ void Swapfile::cfsdchecked() void Swapfile::makeswapfile() -{ +{ int i = swapSize->currentItem(); - mkswapProgress->setProgress(1); + mkswapProgress->setProgress(1); switch ( i ) { @@ -338,3 +340,3 @@ void Swapfile::makeswapfile() break; - } + } if (rc != 0) { @@ -343,3 +345,3 @@ void Swapfile::makeswapfile() - mkswapProgress->setProgress(2); + mkswapProgress->setProgress(2); rc=exec(QString("mkswap %1").arg(swapPath1->text())); @@ -348,6 +350,6 @@ void Swapfile::makeswapfile() } - mkswapProgress->setProgress(3); - mkswapProgress->reset(); + mkswapProgress->setProgress(3); + mkswapProgress->reset(); setStatusMessage(tr("Swapfile created.")); -} +} @@ -376,3 +378,3 @@ void Swapfile::status() fclose(fp); - + ramRB->setChecked(FALSE); @@ -383,3 +385,3 @@ void Swapfile::status() if ( i == 0 ) { - ramRB->setChecked(TRUE); + ramRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ @@ -389,3 +391,3 @@ void Swapfile::status() if ( i == 0 ) { - cfRB->setChecked(TRUE); + cfRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ @@ -395,3 +397,3 @@ void Swapfile::status() if ( i == 0 ) { - cfRB->setChecked(TRUE); + cfRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ @@ -401,3 +403,3 @@ void Swapfile::status() if ( i == 0 ) { - sdRB->setChecked(TRUE); + sdRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ @@ -407,3 +409,3 @@ void Swapfile::status() if ( i == 0 ) { - sdRB->setChecked(TRUE); + sdRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ @@ -413,4 +415,4 @@ void Swapfile::status() Swapfile::cfsdchecked(); - - + + swapsize /=1000; @@ -426,4 +428,4 @@ void Swapfile::status() break; - } - + } + |