Changeset View
Changeset View
Standalone View
Standalone View
krusader/FileSystem/krtrashhandler.cpp
Show All 32 Lines | |||||
33 | #include <KJobWidgets/KJobWidgets> | 33 | #include <KJobWidgets/KJobWidgets> | ||
34 | 34 | | |||
35 | #include "filesystemprovider.h" | 35 | #include "filesystemprovider.h" | ||
36 | #include "../kractions.h" | 36 | #include "../kractions.h" | ||
37 | #include "../krglobal.h" | 37 | #include "../krglobal.h" | ||
38 | #include "../icon.h" | 38 | #include "../icon.h" | ||
39 | 39 | | |||
40 | 40 | | |||
41 | KrTrashWatcher * KrTrashHandler::_trashWatcher = 0; | 41 | KrTrashWatcher * KrTrashHandler::_trashWatcher = nullptr; | ||
42 | 42 | | |||
43 | bool KrTrashHandler::isTrashEmpty() | 43 | bool KrTrashHandler::isTrashEmpty() | ||
44 | { | 44 | { | ||
45 | KConfig trashConfig("trashrc"); | 45 | KConfig trashConfig("trashrc"); | ||
46 | KConfigGroup cfg(&trashConfig, "Status"); | 46 | KConfigGroup cfg(&trashConfig, "Status"); | ||
47 | return cfg.readEntry("Empty", false); | 47 | return cfg.readEntry("Empty", false); | ||
48 | } | 48 | } | ||
49 | 49 | | |||
Show All 35 Lines | |||||
85 | { | 85 | { | ||
86 | if (!_trashWatcher) | 86 | if (!_trashWatcher) | ||
87 | _trashWatcher = new KrTrashWatcher(); | 87 | _trashWatcher = new KrTrashWatcher(); | ||
88 | } | 88 | } | ||
89 | 89 | | |||
90 | void KrTrashHandler::stopWatcher() | 90 | void KrTrashHandler::stopWatcher() | ||
91 | { | 91 | { | ||
92 | delete _trashWatcher; | 92 | delete _trashWatcher; | ||
93 | _trashWatcher = 0; | 93 | _trashWatcher = nullptr; | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | 96 | | |||
97 | KrTrashWatcher::KrTrashWatcher() | 97 | KrTrashWatcher::KrTrashWatcher() | ||
98 | { | 98 | { | ||
99 | _watcher = new KDirWatch(); | 99 | _watcher = new KDirWatch(); | ||
100 | connect(_watcher, &KDirWatch::created, this, &KrTrashWatcher::slotTrashChanged); | 100 | connect(_watcher, &KDirWatch::created, this, &KrTrashWatcher::slotTrashChanged); | ||
101 | connect(_watcher, &KDirWatch::dirty, this, &KrTrashWatcher::slotTrashChanged); | 101 | connect(_watcher, &KDirWatch::dirty, this, &KrTrashWatcher::slotTrashChanged); | ||
102 | const QString trashrcFile = | 102 | const QString trashrcFile = | ||
103 | QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).filePath("trashrc"); | 103 | QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).filePath("trashrc"); | ||
104 | _watcher->addFile(trashrcFile); | 104 | _watcher->addFile(trashrcFile); | ||
105 | _watcher->startScan(true); | 105 | _watcher->startScan(true); | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | KrTrashWatcher::~KrTrashWatcher() | 108 | KrTrashWatcher::~KrTrashWatcher() | ||
109 | { | 109 | { | ||
110 | delete _watcher; | 110 | delete _watcher; | ||
111 | _watcher = 0; | 111 | _watcher = nullptr; | ||
112 | } | 112 | } | ||
113 | 113 | | |||
114 | void KrTrashWatcher::slotTrashChanged() | 114 | void KrTrashWatcher::slotTrashChanged() | ||
115 | { | 115 | { | ||
116 | KrActions::actTrashBin->setIcon(Icon(KrTrashHandler::trashIconName())); | 116 | KrActions::actTrashBin->setIcon(Icon(KrTrashHandler::trashIconName())); | ||
117 | } | 117 | } |