KIO

kshellcompletion.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2000 David Smith <[email protected]>
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 
18 class 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 <[email protected]>
31  */
32 class KIOWIDGETS_EXPORT KShellCompletion : public KUrlCompletion
33 {
34  Q_OBJECT
35 
36 public:
37  /**
38  * Constructs a KShellCompletion object.
39  */
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 
51 protected:
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 
57 private:
58  std::unique_ptr<KShellCompletionPrivate> const d;
59 };
60 
61 #endif // KSHELLCOMPLETION_H
Completion of a single URL.
QString makeCompletion(const QString &text) override
Finds completions to the given text.
Shell-like completion of file names.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 10 2023 03:50:34 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.