Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/kbuildsycocaprogressdialog.cpp
Show All 13 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to | ||
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
16 | Boston, MA 02110-1301, USA. | 16 | Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | #include "kbuildsycocaprogressdialog.h" | 18 | #include "kbuildsycocaprogressdialog.h" | ||
19 | #include <ksycoca.h> | 19 | #include <ksycoca.h> | ||
20 | #include <qstandardpaths.h> | 20 | #include <qstandardpaths.h> | ||
21 | #include <klocalizedstring.h> | 21 | #include <klocalizedstring.h> | ||
22 | #include <QDBusConnection> | | |||
23 | #include <QDBusInterface> | | |||
24 | #include <QProcess> | 22 | #include <QProcess> | ||
25 | #include <QDialogButtonBox> | 23 | #include <QDialogButtonBox> | ||
26 | 24 | | |||
27 | class KBuildSycocaProgressDialogPrivate | 25 | class KBuildSycocaProgressDialogPrivate | ||
28 | { | 26 | { | ||
29 | public: | 27 | public: | ||
30 | explicit KBuildSycocaProgressDialogPrivate(KBuildSycocaProgressDialog *parent) | 28 | explicit KBuildSycocaProgressDialogPrivate(KBuildSycocaProgressDialog *parent) | ||
31 | : m_parent(parent) | 29 | : m_parent(parent) | ||
32 | { | 30 | { | ||
33 | } | 31 | } | ||
34 | 32 | | |||
35 | KBuildSycocaProgressDialog * const m_parent; | 33 | KBuildSycocaProgressDialog * const m_parent; | ||
36 | }; | 34 | }; | ||
37 | 35 | | |||
38 | void KBuildSycocaProgressDialog::rebuildKSycoca(QWidget *parent) | 36 | void KBuildSycocaProgressDialog::rebuildKSycoca(QWidget *parent) | ||
39 | { | 37 | { | ||
40 | KBuildSycocaProgressDialog dlg(parent, | 38 | KBuildSycocaProgressDialog dlg(parent, | ||
41 | i18n("Updating System Configuration"), | 39 | i18n("Updating System Configuration"), | ||
42 | i18n("Updating system configuration.")); | 40 | i18n("Updating system configuration.")); | ||
43 | 41 | | |||
44 | // FIXME HACK: kdelibs 4 doesn't evaluate mimeapps.list at query time; refresh | | |||
45 | // its cache as well. | | |||
46 | QDBusInterface kbuildsycoca4(QStringLiteral("org.kde.kded"), QStringLiteral("/kbuildsycoca"), QStringLiteral("org.kde.kbuildsycoca")); | | |||
47 | if (kbuildsycoca4.isValid()) { | | |||
48 | kbuildsycoca4.call(QDBus::NoBlock, QStringLiteral("recreate")); | | |||
49 | } else { | | |||
50 | QProcess::startDetached(QStringLiteral("kbuildsycoca4"), QStringList()); | | |||
51 | } | | |||
52 | | ||||
53 | QProcess *proc = new QProcess(&dlg); | 42 | QProcess *proc = new QProcess(&dlg); | ||
54 | proc->start(QStringLiteral(KBUILDSYCOCA_EXENAME), QStringList()); | 43 | proc->start(QStringLiteral(KBUILDSYCOCA_EXENAME), QStringList()); | ||
55 | QObject::connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), | 44 | QObject::connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), | ||
56 | &dlg, &QWidget::close); | 45 | &dlg, &QWidget::close); | ||
57 | 46 | | |||
58 | dlg.exec(); | 47 | dlg.exec(); | ||
59 | } | 48 | } | ||
60 | 49 | | |||
Show All 20 Lines |