Changeset View
Changeset View
Standalone View
Standalone View
krusader/MountMan/kmountmangui.cpp
Show All 16 Lines | |||||
17 | * * | 17 | * * | ||
18 | * You should have received a copy of the GNU General Public License * | 18 | * You should have received a copy of the GNU General Public License * | ||
19 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | 19 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | ||
20 | *****************************************************************************/ | 20 | *****************************************************************************/ | ||
21 | 21 | | |||
22 | 22 | | |||
23 | #include "kmountmangui.h" | 23 | #include "kmountmangui.h" | ||
24 | #include "../krglobal.h" | 24 | #include "../krglobal.h" | ||
25 | #include "../icon.h" | ||||
25 | #include "../Dialogs/krspecialwidgets.h" | 26 | #include "../Dialogs/krspecialwidgets.h" | ||
26 | #include "../kicons.h" | | |||
27 | #include "../defaults.h" | 27 | #include "../defaults.h" | ||
28 | #include "../FileSystem/filesystem.h" | 28 | #include "../FileSystem/filesystem.h" | ||
29 | 29 | | |||
30 | // QtCore | 30 | // QtCore | ||
31 | #include <QCryptographicHash> | 31 | #include <QCryptographicHash> | ||
32 | #include <QList> | 32 | #include <QList> | ||
33 | #include <QFileInfo> | 33 | #include <QFileInfo> | ||
34 | // QtGui | 34 | // QtGui | ||
35 | #include <QPixmap> | 35 | #include <QPixmap> | ||
36 | #include <QBitmap> | 36 | #include <QBitmap> | ||
37 | #include <QCursor> | 37 | #include <QCursor> | ||
38 | // QtWidgets | 38 | // QtWidgets | ||
39 | #include <QDialogButtonBox> | 39 | #include <QDialogButtonBox> | ||
40 | #include <QHeaderView> | 40 | #include <QHeaderView> | ||
41 | #include <QGridLayout> | 41 | #include <QGridLayout> | ||
42 | #include <QGroupBox> | 42 | #include <QGroupBox> | ||
43 | #include <QCheckBox> | 43 | #include <QCheckBox> | ||
44 | #include <QMenu> | 44 | #include <QMenu> | ||
45 | #include <QPushButton> | 45 | #include <QPushButton> | ||
46 | 46 | | |||
47 | #include <KConfigCore/KSharedConfig> | 47 | #include <KConfigCore/KSharedConfig> | ||
48 | #include <KI18n/KLocalizedString> | 48 | #include <KI18n/KLocalizedString> | ||
49 | #include <KIconThemes/KIconLoader> | | |||
50 | #include <KWidgetsAddons/KMessageBox> | 49 | #include <KWidgetsAddons/KMessageBox> | ||
51 | #include <KWidgetsAddons/KGuiItem> | 50 | #include <KWidgetsAddons/KGuiItem> | ||
52 | #include <KIOCore/KDiskFreeSpaceInfo> | 51 | #include <KIOCore/KDiskFreeSpaceInfo> | ||
53 | #include <KIOCore/KMountPoint> | 52 | #include <KIOCore/KMountPoint> | ||
54 | #include <KCodecs/KCodecs> | 53 | #include <KCodecs/KCodecs> | ||
55 | 54 | | |||
56 | #include <Solid/StorageVolume> | 55 | #include <Solid/StorageVolume> | ||
57 | 56 | | |||
Show All 20 Lines | 69 | { | |||
78 | connect(watcher, SIGNAL(timeout()), this, SLOT(checkMountChange())); | 77 | connect(watcher, SIGNAL(timeout()), this, SLOT(checkMountChange())); | ||
79 | 78 | | |||
80 | mainLayout->addLayout(createMainPage()); | 79 | mainLayout->addLayout(createMainPage()); | ||
81 | 80 | | |||
82 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); | 81 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); | ||
83 | mainLayout->addWidget(buttonBox); | 82 | mainLayout->addWidget(buttonBox); | ||
84 | 83 | | |||
85 | ejectButton = new QPushButton(i18n("&Eject")); | 84 | ejectButton = new QPushButton(i18n("&Eject")); | ||
86 | ejectButton->setIcon(QIcon::fromTheme(QStringLiteral("media-eject"))); | 85 | ejectButton->setIcon(Icon(QStringLiteral("media-eject"))); | ||
87 | ejectButton->setEnabled(false); | 86 | ejectButton->setEnabled(false); | ||
88 | buttonBox->addButton(ejectButton, QDialogButtonBox::ActionRole); | 87 | buttonBox->addButton(ejectButton, QDialogButtonBox::ActionRole); | ||
89 | 88 | | |||
90 | mountButton = new QPushButton(i18n("&Unmount")); | 89 | mountButton = new QPushButton(i18n("&Unmount")); | ||
91 | mountButton->setEnabled(false); | 90 | mountButton->setEnabled(false); | ||
92 | buttonBox->addButton(mountButton, QDialogButtonBox::ActionRole); | 91 | buttonBox->addButton(mountButton, QDialogButtonBox::ActionRole); | ||
93 | 92 | | |||
94 | // connections | 93 | // connections | ||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Line(s) | 272 | { | |||
285 | item->setText(0, fs.name()); | 284 | item->setText(0, fs.name()); | ||
286 | item->setText(1, fs.type()); | 285 | item->setText(1, fs.type()); | ||
287 | item->setText(2, fs.mntPoint()); | 286 | item->setText(2, fs.mntPoint()); | ||
288 | item->setText(3, (mtd ? tSize : QString("N/A"))); | 287 | item->setText(3, (mtd ? tSize : QString("N/A"))); | ||
289 | item->setText(4, (mtd ? fSize : QString("N/A"))); | 288 | item->setText(4, (mtd ? fSize : QString("N/A"))); | ||
290 | item->setText(5, (mtd ? sPrct : QString("N/A"))); | 289 | item->setText(5, (mtd ? sPrct : QString("N/A"))); | ||
291 | 290 | | |||
292 | Solid::StorageVolume *vol = device.as<Solid::StorageVolume> (); | 291 | Solid::StorageVolume *vol = device.as<Solid::StorageVolume> (); | ||
293 | QString icon; | 292 | QString iconName; | ||
294 | 293 | | |||
295 | if(device.isValid()) | 294 | if(device.isValid()) | ||
296 | icon = device.icon(); | 295 | iconName = device.icon(); | ||
297 | else if(mountMan->networkFilesystem(fs.type())) | 296 | else if(mountMan->networkFilesystem(fs.type())) | ||
298 | icon = "folder-remote"; | 297 | iconName = "folder-remote"; | ||
299 | QStringList overlays; | 298 | QStringList overlays; | ||
300 | if (mtd) { | 299 | if (mtd) { | ||
301 | overlays << "emblem-mounted"; | 300 | overlays << "emblem-mounted"; | ||
302 | } else { | 301 | } else { | ||
303 | overlays << QString(); // We have to guarantee the placement of the next emblem | 302 | overlays << QString(); // We have to guarantee the placement of the next emblem | ||
304 | } | 303 | } | ||
305 | if (vol && vol->usage() == Solid::StorageVolume::Encrypted) { | 304 | if (vol && vol->usage() == Solid::StorageVolume::Encrypted) { | ||
306 | overlays << "security-high"; | 305 | overlays << "security-high"; | ||
307 | } | 306 | } | ||
308 | item->setIcon(0, KDE::icon(icon, overlays)); | 307 | item->setIcon(0, Icon(iconName, overlays)); | ||
309 | } | 308 | } | ||
310 | 309 | | |||
311 | void KMountManGUI::updateList() | 310 | void KMountManGUI::updateList() | ||
312 | { | 311 | { | ||
313 | QString currentMP; | 312 | QString currentMP; | ||
314 | int currentIdx = 0; | 313 | int currentIdx = 0; | ||
315 | QTreeWidgetItem *currentItem = mountList->currentItem(); | 314 | QTreeWidgetItem *currentItem = mountList->currentItem(); | ||
316 | if(currentItem) { | 315 | if(currentItem) { | ||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |