-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 @@ | |||
22 | 22 | ||
23 | #include <qfile.h> | ||
24 | #include <qtextstream.h> | ||
23 | #include <qlabel.h> | 25 | #include <qlabel.h> |
@@ -26,9 +28,9 @@ | |||
26 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
27 | #include <qhbuttongroup.h> | 29 | #include <qhbuttongroup.h> |
28 | #include <qradiobutton.h> | 30 | #include <qradiobutton.h> |
29 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
30 | #include <qprogressbar.h> | 32 | #include <qprogressbar.h> |
31 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
32 | #include <qvgroupbox.h> | 34 | #include <qvgroupbox.h> |
33 | #include <qhbox.h> | 35 | #include <qhbox.h> |
34 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
@@ -45,4 +47,4 @@ | |||
45 | #include <mntent.h> | 47 | #include <mntent.h> |
46 | #include <unistd.h> | 48 | #include <unistd.h> |
47 | #include <sys/types.h> | 49 | #include <sys/types.h> |
48 | 50 | ||
@@ -59,3 +61,3 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) | |||
59 | vb->addWidget(cfsdRBG); | 61 | vb->addWidget(cfsdRBG); |
60 | 62 | ||
61 | ramRB = new QRadioButton(tr("RAM"), cfsdRBG); | 63 | ramRB = new QRadioButton(tr("RAM"), cfsdRBG); |
@@ -108,3 +110,3 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) | |||
108 | sdRB->setEnabled(FALSE); | 110 | sdRB->setEnabled(FALSE); |
109 | 111 | ||
110 | QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); | 112 | QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); |
@@ -113,3 +115,3 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) | |||
113 | connect(sdChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); | 115 | connect(sdChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); |
114 | 116 | ||
115 | cardInPcmcia0 = FALSE; | 117 | cardInPcmcia0 = FALSE; |
@@ -135,7 +137,7 @@ void Swapfile::cardnotify(const QCString & msg, const QByteArray &) | |||
135 | { | 137 | { |
136 | if (msg == "stabChanged()") | 138 | if (msg == "stabChanged()") |
137 | { | 139 | { |
138 | getStatusPcmcia(); | 140 | getStatusPcmcia(); |
139 | } | 141 | } |
140 | else if (msg == "mtabChanged()") | 142 | else if (msg == "mtabChanged()") |
141 | { | 143 | { |
@@ -195,6 +197,6 @@ void Swapfile::getStatusPcmcia() | |||
195 | if (cardInPcmcia0) { | 197 | if (cardInPcmcia0) { |
196 | cfRB->setEnabled(TRUE); | 198 | cfRB->setEnabled(TRUE); |
197 | } else { | 199 | } else { |
198 | cfRB->setChecked(FALSE); | 200 | cfRB->setChecked(FALSE); |
199 | cfRB->setEnabled(FALSE); | 201 | cfRB->setEnabled(FALSE); |
200 | } | 202 | } |
@@ -204,6 +206,6 @@ void Swapfile::getStatusPcmcia() | |||
204 | if (cardInPcmcia1) { | 206 | if (cardInPcmcia1) { |
205 | cfRB->setEnabled(TRUE); | 207 | cfRB->setEnabled(TRUE); |
206 | } else { | 208 | } else { |
207 | cfRB->setChecked(FALSE); | 209 | cfRB->setChecked(FALSE); |
208 | cfRB->setEnabled(FALSE); | 210 | cfRB->setEnabled(FALSE); |
209 | } | 211 | } |
@@ -247,6 +249,6 @@ void Swapfile::getStatusSd() | |||
247 | if (cardInSd) { | 249 | if (cardInSd) { |
248 | sdRB->setEnabled(TRUE); | 250 | sdRB->setEnabled(TRUE); |
249 | } else { | 251 | } else { |
250 | sdRB->setChecked(FALSE); | 252 | sdRB->setChecked(FALSE); |
251 | sdRB->setEnabled(FALSE); | 253 | sdRB->setEnabled(FALSE); |
252 | } | 254 | } |
@@ -289,3 +291,3 @@ void Swapfile::swapoff() | |||
289 | char swapcmd[128] ="swapoff "; | 291 | char swapcmd[128] ="swapoff "; |
290 | if (Swapfile::cfRB->isChecked() == TRUE) | 292 | if (Swapfile::cfRB->isChecked() == TRUE) |
291 | Swapfile::cfsdchecked(); | 293 | Swapfile::cfsdchecked(); |
@@ -309,3 +311,3 @@ void Swapfile::cfsdchecked() | |||
309 | Swapfile::swapPath1->clear(); | 311 | Swapfile::swapPath1->clear(); |
310 | if (Swapfile::ramRB->isChecked() == TRUE) | 312 | if (Swapfile::ramRB->isChecked() == TRUE) |
311 | { | 313 | { |
@@ -325,6 +327,6 @@ void Swapfile::cfsdchecked() | |||
325 | void Swapfile::makeswapfile() | 327 | void Swapfile::makeswapfile() |
326 | { | 328 | { |
327 | int i = swapSize->currentItem(); | 329 | int i = swapSize->currentItem(); |
328 | 330 | ||
329 | mkswapProgress->setProgress(1); | 331 | mkswapProgress->setProgress(1); |
330 | switch ( i ) { | 332 | switch ( i ) { |
@@ -338,3 +340,3 @@ void Swapfile::makeswapfile() | |||
338 | break; | 340 | break; |
339 | } | 341 | } |
340 | if (rc != 0) { | 342 | if (rc != 0) { |
@@ -343,3 +345,3 @@ void Swapfile::makeswapfile() | |||
343 | 345 | ||
344 | mkswapProgress->setProgress(2); | 346 | mkswapProgress->setProgress(2); |
345 | rc=exec(QString("mkswap %1").arg(swapPath1->text())); | 347 | rc=exec(QString("mkswap %1").arg(swapPath1->text())); |
@@ -348,6 +350,6 @@ void Swapfile::makeswapfile() | |||
348 | } | 350 | } |
349 | mkswapProgress->setProgress(3); | 351 | mkswapProgress->setProgress(3); |
350 | mkswapProgress->reset(); | 352 | mkswapProgress->reset(); |
351 | setStatusMessage(tr("Swapfile created.")); | 353 | setStatusMessage(tr("Swapfile created.")); |
352 | } | 354 | } |
353 | 355 | ||
@@ -376,3 +378,3 @@ void Swapfile::status() | |||
376 | fclose(fp); | 378 | fclose(fp); |
377 | 379 | ||
378 | ramRB->setChecked(FALSE); | 380 | ramRB->setChecked(FALSE); |
@@ -383,3 +385,3 @@ void Swapfile::status() | |||
383 | if ( i == 0 ) { | 385 | if ( i == 0 ) { |
384 | ramRB->setChecked(TRUE); | 386 | ramRB->setChecked(TRUE); |
385 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ | 387 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ |
@@ -389,3 +391,3 @@ void Swapfile::status() | |||
389 | if ( i == 0 ) { | 391 | if ( i == 0 ) { |
390 | cfRB->setChecked(TRUE); | 392 | cfRB->setChecked(TRUE); |
391 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ | 393 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ |
@@ -395,3 +397,3 @@ void Swapfile::status() | |||
395 | if ( i == 0 ) { | 397 | if ( i == 0 ) { |
396 | cfRB->setChecked(TRUE); | 398 | cfRB->setChecked(TRUE); |
397 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ | 399 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ |
@@ -401,3 +403,3 @@ void Swapfile::status() | |||
401 | if ( i == 0 ) { | 403 | if ( i == 0 ) { |
402 | sdRB->setChecked(TRUE); | 404 | sdRB->setChecked(TRUE); |
403 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ | 405 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ |
@@ -407,3 +409,3 @@ void Swapfile::status() | |||
407 | if ( i == 0 ) { | 409 | if ( i == 0 ) { |
408 | sdRB->setChecked(TRUE); | 410 | sdRB->setChecked(TRUE); |
409 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ | 411 | /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ |
@@ -413,4 +415,4 @@ void Swapfile::status() | |||
413 | Swapfile::cfsdchecked(); | 415 | Swapfile::cfsdchecked(); |
414 | 416 | ||
415 | 417 | ||
416 | swapsize /=1000; | 418 | swapsize /=1000; |
@@ -426,4 +428,4 @@ void Swapfile::status() | |||
426 | break; | 428 | break; |
427 | } | 429 | } |
428 | 430 | ||
429 | 431 | ||