1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2000 David Smith <dsmith@algonet.se>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KSHELLCOMPLETION_H
9#define KSHELLCOMPLETION_H
10
11#include <QString>
12#include <QStringList>
13
14#include "kurlcompletion.h"
15
16#include <memory>
17
18class KShellCompletionPrivate;
19
20/**
21 * @class KShellCompletion kshellcompletion.h <KShellCompletion>
22 *
23 * This class does shell-like completion of file names.
24 * A string passed to makeCompletion() will be interpreted as a shell
25 * command line. Completion will be done on the last argument on the line.
26 * Returned matches consist of the first arguments (uncompleted) plus the
27 * completed last argument.
28 *
29 * @short Shell-like completion of file names
30 * @author David Smith <dsmith@algonet.se>
31 */
32class KIOWIDGETS_EXPORT KShellCompletion : public KUrlCompletion
33{
34 Q_OBJECT
35
36public:
37 /**
38 * Constructs a KShellCompletion object.
39 */
40 KShellCompletion();
41 ~KShellCompletion() override;
42
43 /**
44 * Finds completions to the given text.
45 * The first match is returned and emitted in the signal match().
46 * @param text the text to complete
47 * @return the first match, or QString() if not found
48 */
49 QString makeCompletion(const QString &text) override;
50
51protected:
52 // Called by KCompletion
53 void postProcessMatch(QString *match) const override;
54 void postProcessMatches(QStringList *matches) const override;
55 void postProcessMatches(KCompletionMatches *matches) const override;
56
57private:
58 std::unique_ptr<KShellCompletionPrivate> const d;
59};
60
61#endif // KSHELLCOMPLETION_H
62

source code of kio/src/widgets/kshellcompletion.h