1
/***************************************************************************
2
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18
***************************************************************************/
20
#include "gui/filesystemsupportdialog.h"
22
#include "fs/filesystem.h"
23
#include "fs/filesystemfactory.h"
28
#include <kpushbutton.h>
29
#include <kiconloader.h>
31
/** Creates a new FileSystemSupportDialog
32
@param parent the parent object
34
FileSystemSupportDialog::FileSystemSupportDialog(QWidget* parent) :
36
m_FileSystemSupportDialogWidget(new FileSystemSupportDialogWidget(this))
38
setMainWidget(&dialogWidget());
39
setCaption(i18nc("@title:window", "File System Support"));
40
setButtons(KDialog::Ok);
42
resize(dialogWidget().width(), dialogWidget().height());
47
restoreDialogSize(KConfigGroup(KGlobal::config(), "fileSystemSupportDialog"));
50
/** Destroys a FileSystemSupportDialog */
51
FileSystemSupportDialog::~FileSystemSupportDialog()
53
KConfigGroup kcg(KGlobal::config(), "fileSystemSupportDialog");
57
void FileSystemSupportDialog::setupDialog()
59
QPixmap yes(BarIcon("dialog-ok"));
60
QPixmap no(BarIcon("dialog-error"));
62
dialogWidget().tree().clear();
64
foreach(const FileSystem* fs, FileSystemFactory::map().values())
66
if (fs->type() == FileSystem::Unknown || fs->type() == FileSystem::Extended)
69
QTreeWidgetItem* item = new QTreeWidgetItem();
72
item->setText(i++, fs->name());
73
item->setIcon(i++, fs->supportCreate() ? yes : no);
74
item->setIcon(i++, fs->supportGrow() ? yes : no);
75
item->setIcon(i++, fs->supportShrink() ? yes : no);
76
item->setIcon(i++, fs->supportMove() ? yes : no);
77
item->setIcon(i++, fs->supportCopy() ? yes : no);
78
item->setIcon(i++, fs->supportCheck() ? yes : no);
79
item->setIcon(i++, fs->supportGetLabel() ? yes : no);
80
item->setIcon(i++, fs->supportSetLabel() ? yes : no);
81
item->setIcon(i++, fs->supportGetUsed() ? yes : no);
82
item->setIcon(i++, fs->supportBackup() ? yes : no);
84
// there is no FileSystem::supportRestore(), because we currently can't tell
85
// if a file is an image of a supported or unsupported (or even invalid) filesystem
86
item->setIcon(i++, yes);
88
dialogWidget().tree().addTopLevelItem(item);
91
for(int i = 0; i < dialogWidget().tree().columnCount(); i++)
92
dialogWidget().tree().resizeColumnToContents(i);
94
dialogWidget().tree().sortItems(0, Qt::AscendingOrder);
97
void FileSystemSupportDialog::setupConnections()
99
connect(&dialogWidget().buttonRescan(), SIGNAL(clicked()), SLOT(onButtonRescanClicked()));
102
void FileSystemSupportDialog::onButtonRescanClicked()
104
FileSystemFactory::init();