Changeset View
Changeset View
Standalone View
Standalone View
kcms/icons/main.cpp
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Line(s) | 163 | for (const QString &themeName : pendingDeletions) { | |||
---|---|---|---|---|---|
167 | auto *job = KIO::del(QUrl::fromLocalFile(theme.dir()), KIO::HideProgressInfo); | 167 | auto *job = KIO::del(QUrl::fromLocalFile(theme.dir()), KIO::HideProgressInfo); | ||
168 | // needs to block for it to work on "OK" where the dialog (kcmshell) closes | 168 | // needs to block for it to work on "OK" where the dialog (kcmshell) closes | ||
169 | job->exec(); | 169 | job->exec(); | ||
170 | } | 170 | } | ||
171 | 171 | | |||
172 | m_model->removeItemsPendingDeletion(); | 172 | m_model->removeItemsPendingDeletion(); | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | void IconModule::getNewStuff(QQuickItem *ctx) | 175 | void IconModule::getNewStuff(QQuickItem *ctx) | ||
davidedmundson: FWIW, there is an alternative approach that we do in plasma-workspace… | |||||
That does sound like something that would be good to look at at a later point in time (it'd make this whole thing vastly more involved, and i'm trying to keep it a bit more simple for now) leinir: That does sound like something that would be good to look at at a later point in time (it'd… | |||||
176 | { | 176 | { | ||
177 | if (!m_newStuffDialog) { | 177 | if (changedEntries.count() == 0) { | ||
178 | m_newStuffDialog = new KNS3::DownloadDialog(QStringLiteral("icons.knsrc")); | | |||
179 | m_newStuffDialog->setWindowTitle(i18n("Download New Icon Themes")); | | |||
180 | m_newStuffDialog->setWindowModality(Qt::WindowModal); | | |||
181 | m_newStuffDialog->winId(); // so it creates the windowHandle(); | | |||
182 | // TODO would be lovely to scroll to and select the newly installed scheme, if any | | |||
183 | connect(m_newStuffDialog.data(), &KNS3::DownloadDialog::accepted, this, [this] { | | |||
184 | if (m_newStuffDialog->changedEntries().isEmpty()) { | | |||
185 | return; | 178 | return; | ||
186 | } | 179 | } | ||
187 | 180 | | |||
188 | // reload the display icontheme items | 181 | // reload the display icontheme items | ||
189 | KIconLoader::global()->newIconLoader(); | 182 | KIconLoader::global()->newIconLoader(); | ||
190 | m_model->load(); | 183 | m_model->load(); | ||
191 | QPixmapCache::clear(); | 184 | QPixmapCache::clear(); | ||
192 | }); | | |||
193 | } | | |||
194 | | ||||
195 | if (ctx && ctx->window()) { | | |||
196 | m_newStuffDialog->windowHandle()->setTransientParent(ctx->window()); | | |||
Does this code still exist? I can't see an equivalent in knewstuff. It's especially important on wayland davidedmundson: Does this code still exist? I can't see an equivalent in knewstuff.
It's especially important… | |||||
The new dialog is entirely QtQuick (clicking the NewStuff.Button essentially just calls open() on a QtQuick.Dialogs Dialog, so if doing show on a QtQuick Dialog does the trick, then yes. Otherwise i am... severely uncertain of how that might be solved (though it would be central at least, since the code would be in KNSQuick). leinir: The new dialog is entirely QtQuick (clicking the NewStuff.Button essentially just calls open()… | |||||
197 | } | | |||
198 | | ||||
199 | m_newStuffDialog->show(); | | |||
200 | } | 185 | } | ||
201 | 186 | | |||
202 | void IconModule::installThemeFromFile(const QUrl &url) | 187 | void IconModule::installThemeFromFile(const QUrl &url) | ||
203 | { | 188 | { | ||
204 | if (url.isLocalFile()) { | 189 | if (url.isLocalFile()) { | ||
205 | installThemeFile(url.toLocalFile()); | 190 | installThemeFile(url.toLocalFile()); | ||
206 | return; | 191 | return; | ||
207 | } | 192 | } | ||
▲ Show 20 Lines • Show All 301 Lines • Show Last 20 Lines |
FWIW, there is an alternative approach that we do in plasma-workspace (shell/containmentconfigview.cpp) for reloading wallpapers types.
kpackage emits a DBus signal when it performs an action, models can listen for this.
We had to do that there because the model was quite separated from the UI.
But it has the advantage that we pick up external changes (i.e through discover or whatever)