File indexing completed on 2025-01-05 04:55:48

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     ui/filenamerequester.h
0003 
0004     This file is part of Kleopatra, the KDE keymanager
0005     SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "kleo_export.h"
0013 
0014 #include <QDir>
0015 #include <QWidget>
0016 
0017 namespace Kleo
0018 {
0019 
0020 class KLEO_EXPORT FileNameRequester : public QWidget
0021 {
0022     Q_OBJECT
0023     Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
0024     Q_PROPERTY(bool existingOnly READ existingOnly WRITE setExistingOnly)
0025 public:
0026     explicit FileNameRequester(QWidget *parent = nullptr);
0027     explicit FileNameRequester(QDir::Filters filter, QWidget *parent = nullptr);
0028     ~FileNameRequester() override;
0029 
0030     void setFileName(const QString &name);
0031     QString fileName() const;
0032 
0033     void setExistingOnly(bool on);
0034     bool existingOnly() const;
0035 
0036     void setFilter(QDir::Filters f);
0037     QDir::Filters filter() const;
0038 
0039     void setNameFilter(const QString &nameFilter);
0040     QString nameFilter() const;
0041 
0042     void setAccessibleNameOfLineEdit(const QString &name);
0043 
0044 Q_SIGNALS:
0045     void fileNameChanged(const QString &filename);
0046 
0047 protected:
0048     bool event(QEvent *event) override;
0049 
0050 private:
0051     virtual QString requestFileName();
0052 
0053 private:
0054     class FileNameRequesterPrivate;
0055     std::unique_ptr<FileNameRequesterPrivate> const d;
0056 };
0057 
0058 }