File indexing completed on 2024-05-12 05:12:45

0001 /*
0002     This file is part of Akonadi.
0003 
0004     SPDX-FileCopyrightText: 2012 Volker Krause <vkrause@kde.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include "libakonadiconsole_export.h"
0012 #include "mainwindow.h"
0013 
0014 #include <QDialog>
0015 
0016 namespace Ui
0017 {
0018 class InstanceSelector;
0019 }
0020 
0021 /** Check if there are multiple instances of Akonadi running, and if so present
0022  *  a list to select the one to connect to.
0023  */
0024 class LIBAKONADICONSOLE_EXPORT InstanceSelector : public QDialog
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit InstanceSelector(const QString &remoteHost, QWidget *parent = nullptr, Qt::WindowFlags flags = {});
0029     ~InstanceSelector() override;
0030 
0031 private:
0032     static QStringList instances();
0033 
0034 private:
0035     void slotAccept();
0036     void slotReject();
0037     QScopedPointer<Ui::InstanceSelector> ui;
0038     const QString m_remoteHost;
0039     QString m_instance;
0040     MainWindow *mWindow = nullptr;
0041 };