summaryrefslogtreecommitdiff
path: root/noncore/applets/memoryapplet/swapfile.cpp
Unidiff
Diffstat (limited to 'noncore/applets/memoryapplet/swapfile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/memoryapplet/swapfile.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp
index 04da8bb..9416db3 100644
--- a/noncore/applets/memoryapplet/swapfile.cpp
+++ b/noncore/applets/memoryapplet/swapfile.cpp
@@ -65,99 +65,99 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f )
65 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); 65 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG);
66 66
67 QHBox *hb1 = new QHBox(this); 67 QHBox *hb1 = new QHBox(this);
68 hb1->setSpacing(5); 68 hb1->setSpacing(5);
69 69
70 swapPath1 = new QLineEdit(hb1); 70 swapPath1 = new QLineEdit(hb1);
71 swapPath1->setEnabled(false); 71 swapPath1->setEnabled(false);
72 72
73 QPushButton* swapOn = new QPushButton(tr(" On "), hb1); 73 QPushButton* swapOn = new QPushButton(tr(" On "), hb1);
74 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); 74 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1);
75 vb->addWidget(hb1); 75 vb->addWidget(hb1);
76 76
77 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); 77 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this);
78 vb->addWidget(box1); 78 vb->addWidget(box1);
79 79
80 QHBox *hb2 = new QHBox(box1); 80 QHBox *hb2 = new QHBox(box1);
81 hb2->setSpacing(5); 81 hb2->setSpacing(5);
82 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); 82 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2);
83 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); 83 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2);
84 84
85 QHBox *hb3 = new QHBox(box1); 85 QHBox *hb3 = new QHBox(box1);
86 hb3->setSpacing(5); 86 hb3->setSpacing(5);
87 swapSize = new QComboBox(hb3); 87 swapSize = new QComboBox(hb3);
88 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb"))); 88 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb")));
89 89
90 mkswapProgress = new QProgressBar(3, hb3); 90 mkswapProgress = new QProgressBar(3, hb3);
91 mkswapProgress->setCenterIndicator(true); 91 mkswapProgress->setCenterIndicator(true);
92 92
93 QHBox *hb4 = new QHBox(this); 93 QHBox *hb4 = new QHBox(this);
94 hb4->setSpacing(5); 94 hb4->setSpacing(5);
95 95
96 swapStatusIcon = new QLabel(hb4); 96 swapStatusIcon = new QLabel(hb4);
97 swapStatus = new QLabel(tr(""), hb4); 97 swapStatus = new QLabel(tr(""), hb4);
98 hb4->setStretchFactor(swapStatus, 99); 98 hb4->setStretchFactor(swapStatus, 99);
99 vb->addWidget(hb4); 99 vb->addWidget(hb4);
100 100
101 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon())); 101 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon()));
102 connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff())); 102 connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff()));
103 connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 103 connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
104 connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 104 connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
105 connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 105 connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
106 connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile())); 106 connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile()));
107 connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile())); 107 connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile()));
108 108
109 cfRB->setEnabled(FALSE); 109 cfRB->setEnabled(FALSE);
110 sdRB->setEnabled(FALSE); 110 sdRB->setEnabled(FALSE);
111 111
112 QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); 112 QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this);
113 connect(pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); 113 connect(pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&)));
114 QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); 114 QCopChannel *sdChannel = new QCopChannel("QPE/Card", this);
115 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&)));
116 116
117 cardInPcmcia0 = FALSE; 117 cardInPcmcia0 = FALSE;
118 cardInPcmcia1 = FALSE; 118 cardInPcmcia1 = FALSE;
119 cardInSd = FALSE; 119 cardInSd = FALSE;
120 120
121 Swapfile::status(); 121 Swapfile::status();
122 Swapfile::getStatusPcmcia(); 122 Swapfile::getStatusPcmcia();
123 Swapfile::getStatusSd(); 123 Swapfile::getStatusSd();
124} 124}
125 125
126int Swapfile::exec(const QString& arg) 126int Swapfile::exec(const QString& arg)
127{ 127{
128 return system((!isRoot ? "sudo " : "") + arg); 128 return system((!isRoot ? "sudo " : "") + arg);
129} 129}
130 130
131 131
132Swapfile::~Swapfile() 132Swapfile::~Swapfile()
133{ 133{
134} 134}
135 135
136void Swapfile::cardnotify(const QCString & msg, const QByteArray &) 136void Swapfile::cardnotify(const QCString & msg, const QByteArray &)
137{ 137{
138 if (msg == "stabChanged()") 138 if (msg == "stabChanged()")
139 { 139 {
140 getStatusPcmcia(); 140 getStatusPcmcia();
141 } 141 }
142 else if (msg == "mtabChanged()") 142 else if (msg == "mtabChanged()")
143 { 143 {
144 getStatusSd(); 144 getStatusSd();
145 } 145 }
146} 146}
147 147
148void Swapfile::getStatusPcmcia() 148void Swapfile::getStatusPcmcia()
149{ 149{
150 150
151 bool cardWas0 = cardInPcmcia0;// remember last state 151 bool cardWas0 = cardInPcmcia0;// remember last state
152 bool cardWas1 = cardInPcmcia1; 152 bool cardWas1 = cardInPcmcia1;
153 153
154 QString fileName; 154 QString fileName;
155 155
156 // one of these 3 files should exist 156 // one of these 3 files should exist
157 if (QFile::exists("/var/run/stab")) { 157 if (QFile::exists("/var/run/stab")) {
158 fileName = "/var/run/stab"; 158 fileName = "/var/run/stab";
159 } else if (QFile::exists("/var/state/pcmcia/stab")) { 159 } else if (QFile::exists("/var/state/pcmcia/stab")) {
160 fileName = "/var/state/pcmcia/stab"; 160 fileName = "/var/state/pcmcia/stab";
161 } else { 161 } else {
162 fileName = "/var/lib/pcmcia/stab"; 162 fileName = "/var/lib/pcmcia/stab";
163 } 163 }