Diffstat (limited to 'noncore/applets/memoryapplet/swapfile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/memoryapplet/swapfile.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp index a71078f..96010c8 100644 --- a/noncore/applets/memoryapplet/swapfile.cpp +++ b/noncore/applets/memoryapplet/swapfile.cpp | |||
@@ -54,97 +54,97 @@ using namespace Opie::Core; | |||
54 | #include <sys/types.h> | 54 | #include <sys/types.h> |
55 | 55 | ||
56 | Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) | 56 | Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) |
57 | : QWidget( parent, name, f ) | 57 | : QWidget( parent, name, f ) |
58 | { | 58 | { |
59 | // are we running as root? | 59 | // are we running as root? |
60 | isRoot = geteuid() == 0; | 60 | isRoot = geteuid() == 0; |
61 | 61 | ||
62 | QVBoxLayout* vb = new QVBoxLayout(this, 5); | 62 | QVBoxLayout* vb = new QVBoxLayout(this, 5); |
63 | 63 | ||
64 | QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); | 64 | QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); |
65 | cfsdRBG->setRadioButtonExclusive(true); | 65 | cfsdRBG->setRadioButtonExclusive(true); |
66 | vb->addWidget(cfsdRBG); | 66 | vb->addWidget(cfsdRBG); |
67 | 67 | ||
68 | ramRB = new QRadioButton(tr("RAM"), cfsdRBG); | 68 | ramRB = new QRadioButton(tr("RAM"), cfsdRBG); |
69 | cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); | 69 | cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); |
70 | sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); | 70 | sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); |
71 | 71 | ||
72 | QHBox *hb1 = new QHBox(this); | 72 | QHBox *hb1 = new QHBox(this); |
73 | hb1->setSpacing(5); | 73 | hb1->setSpacing(5); |
74 | 74 | ||
75 | swapPath1 = new QLineEdit(hb1); | 75 | swapPath1 = new QLineEdit(hb1); |
76 | swapPath1->setEnabled(false); | 76 | swapPath1->setEnabled(false); |
77 | 77 | ||
78 | QPushButton* swapOn = new QPushButton(tr(" On "), hb1); | 78 | QPushButton* swapOn = new QPushButton(tr(" On "), hb1); |
79 | QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); | 79 | QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); |
80 | vb->addWidget(hb1); | 80 | vb->addWidget(hb1); |
81 | 81 | ||
82 | QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); | 82 | QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); |
83 | vb->addWidget(box1); | 83 | vb->addWidget(box1); |
84 | 84 | ||
85 | QHBox *hb2 = new QHBox(box1); | 85 | QHBox *hb2 = new QHBox(box1); |
86 | hb2->setSpacing(5); | 86 | hb2->setSpacing(5); |
87 | QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); | 87 | QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); |
88 | QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); | 88 | QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); |
89 | 89 | ||
90 | QHBox *hb3 = new QHBox(box1); | 90 | QHBox *hb3 = new QHBox(box1); |
91 | hb3->setSpacing(5); | 91 | hb3->setSpacing(5); |
92 | swapSize = new QComboBox(hb3); | 92 | swapSize = new QComboBox(hb3); |
93 | swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb"))); | 93 | swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb"))); |
94 | 94 | ||
95 | mkswapProgress = new QProgressBar(3, hb3); | 95 | mkswapProgress = new QProgressBar(3, hb3); |
96 | mkswapProgress->setCenterIndicator(true); | 96 | mkswapProgress->setCenterIndicator(true); |
97 | 97 | ||
98 | QHBox *hb4 = new QHBox(this); | 98 | QHBox *hb4 = new QHBox(this); |
99 | hb4->setSpacing(5); | 99 | hb4->setSpacing(5); |
100 | 100 | ||
101 | swapStatusIcon = new QLabel(hb4); | 101 | swapStatusIcon = new QLabel(hb4); |
102 | swapStatus = new QLabel(tr(""), hb4); | 102 | swapStatus = new QLabel("", hb4); |
103 | hb4->setStretchFactor(swapStatus, 99); | 103 | hb4->setStretchFactor(swapStatus, 99); |
104 | vb->addWidget(hb4); | 104 | vb->addWidget(hb4); |
105 | 105 | ||
106 | connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon())); | 106 | connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon())); |
107 | connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff())); | 107 | connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff())); |
108 | connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); | 108 | connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); |
109 | connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); | 109 | connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); |
110 | connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); | 110 | connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); |
111 | connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile())); | 111 | connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile())); |
112 | connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile())); | 112 | connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile())); |
113 | 113 | ||
114 | cfRB->setEnabled(FALSE); | 114 | cfRB->setEnabled(FALSE); |
115 | sdRB->setEnabled(FALSE); | 115 | sdRB->setEnabled(FALSE); |
116 | 116 | ||
117 | QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); | 117 | QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); |
118 | connect(pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); | 118 | connect(pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); |
119 | QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); | 119 | QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); |
120 | connect(sdChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); | 120 | connect(sdChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); |
121 | 121 | ||
122 | cardInPcmcia0 = FALSE; | 122 | cardInPcmcia0 = FALSE; |
123 | cardInPcmcia1 = FALSE; | 123 | cardInPcmcia1 = FALSE; |
124 | cardInSd = FALSE; | 124 | cardInSd = FALSE; |
125 | 125 | ||
126 | Swapfile::status(); | 126 | Swapfile::status(); |
127 | Swapfile::getStatusPcmcia(); | 127 | Swapfile::getStatusPcmcia(); |
128 | Swapfile::getStatusSd(); | 128 | Swapfile::getStatusSd(); |
129 | } | 129 | } |
130 | 130 | ||
131 | int Swapfile::exec(const QString& arg) | 131 | int Swapfile::exec(const QString& arg) |
132 | { | 132 | { |
133 | return system((!isRoot ? "sudo " : "") + arg); | 133 | return system((!isRoot ? "sudo " : "") + arg); |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | Swapfile::~Swapfile() | 137 | Swapfile::~Swapfile() |
138 | { | 138 | { |
139 | } | 139 | } |
140 | 140 | ||
141 | void Swapfile::cardnotify(const QCString & msg, const QByteArray &) | 141 | void Swapfile::cardnotify(const QCString & msg, const QByteArray &) |
142 | { | 142 | { |
143 | if (msg == "stabChanged()") | 143 | if (msg == "stabChanged()") |
144 | { | 144 | { |
145 | getStatusPcmcia(); | 145 | getStatusPcmcia(); |
146 | } | 146 | } |
147 | else if (msg == "mtabChanged()") | 147 | else if (msg == "mtabChanged()") |
148 | { | 148 | { |
149 | getStatusSd(); | 149 | getStatusSd(); |
150 | } | 150 | } |