1
//MountManager - the program for easy mounting of storage devices in Linux
2
//Copyright (C) 2007-2008 Tikhonov Sergey
4
//This file is part of MountManager Gui
6
//This program is free software; you can redistribute it and/or
7
//modify it under the terms of the GNU General Public License
8
//as published by the Free Software Foundation; either version 2
9
//of the License, or (at your option) any later version.
11
//This program is distributed in the hope that it will be useful,
12
//but WITHOUT ANY WARRANTY; without even the implied warranty of
13
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
//GNU General Public License for more details.
16
//You should have received a copy of the GNU General Public License
17
//along with this program; if not, write to the Free Software
18
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#include <QVBoxLayout>
20
#include "swapwidget.h"
21
#include "../core/diskdevice.h"
23
SwapWidget::SwapWidget(DiskDevice *dev) {
26
autoMountCheckBox = new QCheckBox(tr("Mount swap during start of the operating system"));
27
autoMountCheckBox->setChecked(true);
29
foreach (QString fstabOption,device->fstabOptions().split(","))
30
if (fstabOption == "noauto") {
31
autoMountCheckBox->setChecked(false);
35
connect(autoMountCheckBox,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
37
QVBoxLayout *mainLayout = new QVBoxLayout;
38
mainLayout->addWidget(autoMountCheckBox);
39
mainLayout->addStretch();
41
setLayout(mainLayout);
44
SwapWidget::~SwapWidget() {
45
delete autoMountCheckBox;
48
QString SwapWidget::fstabLine(const QString &format) {
51
mainLine += device->blockName() + '\t';
52
else if (format == "uuid")
53
mainLine += "UUID=" + device->uuid() + '\t';
54
else if (format == "label") {
55
if (device->label().isEmpty())
56
mainLine += "UUID=" + device->uuid() + '\t';
58
mainLine += "LABEL=" + device->label() + '\t';
60
mainLine += "swap\tswap\t";
61
QString optionsString = "sw";
62
if (!autoMountCheckBox->isChecked())
63
optionsString += ",noauto";
64
mainLine += optionsString + '\t' + "0\t0";