KIO

kbuildsycocaprogressdialog.cpp
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2003 Waldo Bastian <bastian@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7#include "kbuildsycocaprogressdialog.h"
8#include "kio_widgets_debug.h"
9
10#include <KLocalizedString>
11#include <KSycoca>
12
13#include <QDialogButtonBox>
14#include <QProcess>
15#include <QStandardPaths>
16
17class KBuildSycocaProgressDialogPrivate
18{
19public:
20 explicit KBuildSycocaProgressDialogPrivate(KBuildSycocaProgressDialog *parent)
21 : m_parent(parent)
22 {
23 }
24
25 KBuildSycocaProgressDialog *const m_parent;
26};
27
29{
30 KBuildSycocaProgressDialog dlg(parent, i18n("Updating System Configuration"), i18n("Updating system configuration…"));
31
32 const QString exec = QStandardPaths::findExecutable(QStringLiteral(KBUILDSYCOCA_EXENAME));
33 if (exec.isEmpty()) {
34 qCWarning(KIO_WIDGETS) << "Could not find kbuildsycoca executable:" << KBUILDSYCOCA_EXENAME;
35 return;
36 }
37 QProcess *proc = new QProcess(&dlg);
38 proc->start(exec, QStringList());
40
41 dlg.exec();
42}
43
44KBuildSycocaProgressDialog::KBuildSycocaProgressDialog(QWidget *_parent, const QString &title, const QString &text)
45 : QProgressDialog(_parent)
46 , d(new KBuildSycocaProgressDialogPrivate(this))
47{
48 setWindowTitle(title);
49 setModal(true);
50 setLabelText(text);
51 setRange(0, 0);
52 setAutoClose(false);
55}
56
57KBuildSycocaProgressDialog::~KBuildSycocaProgressDialog() = default;
58
59#include "moc_kbuildsycocaprogressdialog.cpp"
Progress dialog while ksycoca is being rebuilt (by kbuildsycoca).
static void rebuildKSycoca(QWidget *parent)
Rebuild KSycoca and show a progress dialog while doing so.
QString i18n(const char *text, const TYPE &arg...)
virtual int exec()
void setModal(bool modal)
QPushButton * button(StandardButton which) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
void finished(int exitCode, QProcess::ExitStatus exitStatus)
void start(OpenMode mode)
void setAutoClose(bool close)
void setLabelText(const QString &text)
void setCancelButton(QPushButton *cancelButton)
void setRange(int minimum, int maximum)
QString findExecutable(const QString &executableName, const QStringList &paths)
bool close()
void setWindowTitle(const QString &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.