File indexing completed on 2024-12-22 04:56:56

0001 /*
0002  *  SPDX-FileCopyrightText: 2011 Grégory Oestreicher <greg@kamago.net>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include "ui_searchdialog.h"
0010 
0011 #include <QDialog>
0012 
0013 class KJob;
0014 class QStandardItemModel;
0015 
0016 class SearchDialog : public QDialog
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit SearchDialog(QWidget *parent = nullptr);
0022     ~SearchDialog() override;
0023 
0024     [[nodiscard]] bool useDefaultCredentials() const;
0025 
0026     void setUsername(const QString &user);
0027     [[nodiscard]] QString username() const;
0028 
0029     void setPassword(const QString &password);
0030     [[nodiscard]] QString password() const;
0031 
0032     [[nodiscard]] QStringList selection() const;
0033 
0034 private:
0035     void checkUserInput();
0036     void search();
0037     void onSearchJobFinished(KJob *job);
0038     void onCollectionsFetchJobFinished(KJob *job);
0039 
0040     Ui::SearchDialog mUi;
0041     QStandardItemModel *const mModel;
0042     int mSubJobCount = 0;
0043 };