diff --git a/src/widgets/messagebox.cpp b/src/widgets/messagebox.cpp index 45956b11..d6a4baaa 100644 --- a/src/widgets/messagebox.cpp +++ b/src/widgets/messagebox.cpp @@ -1,40 +1,33 @@ /* This file is part of Zanshin Copyright 2014 David Faure This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "messagebox.h" -#include - Widgets::MessageBox::~MessageBox() { } QMessageBox::Button Widgets::MessageBox::askConfirmation(QWidget *parent, const QString &title, const QString &text) { return QMessageBox::question(parent, title, text, QMessageBox::Yes | QMessageBox::No); } - -QString Widgets::MessageBox::askTextInput(QWidget *parent, const QString &title, const QString &text) -{ - return QInputDialog::getText(parent, title, text); -} diff --git a/src/widgets/messagebox.h b/src/widgets/messagebox.h index e78598af..85e38ee6 100644 --- a/src/widgets/messagebox.h +++ b/src/widgets/messagebox.h @@ -1,45 +1,44 @@ /* This file is part of Zanshin Copyright 2014 David Faure This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef WIDGETS_MESSAGEBOX_H #define WIDGETS_MESSAGEBOX_H #include "messageboxinterface.h" namespace Widgets { class MessageBox : public MessageBoxInterface { public: typedef QSharedPointer Ptr; virtual ~MessageBox(); QMessageBox::Button askConfirmation(QWidget *parent, const QString &title, const QString &text) override; - QString askTextInput(QWidget *parent, const QString &title, const QString &text) override; }; } #endif diff --git a/src/widgets/messageboxinterface.h b/src/widgets/messageboxinterface.h index 6f4a85ff..ab438a50 100644 --- a/src/widgets/messageboxinterface.h +++ b/src/widgets/messageboxinterface.h @@ -1,51 +1,48 @@ /* This file is part of Zanshin Copyright 2014 David Faure This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef WIDGETS_MESSAGEBOXINTERFACE_H #define WIDGETS_MESSAGEBOXINTERFACE_H #include #include #include class QWidget; namespace Widgets { class MessageBoxInterface { public: typedef QSharedPointer Ptr; virtual ~MessageBoxInterface(); virtual QMessageBox::Button askConfirmation(QWidget *parent, const QString &title, const QString &text) = 0; - - // Now unused - remove? - virtual QString askTextInput(QWidget *parent, const QString &title, const QString &text) = 0; }; } #endif diff --git a/tests/units/widgets/messageboxstub.h b/tests/units/widgets/messageboxstub.h index ff7d9869..ae231726 100644 --- a/tests/units/widgets/messageboxstub.h +++ b/tests/units/widgets/messageboxstub.h @@ -1,55 +1,47 @@ /* This file is part of Zanshin Copyright 2014 David Faure This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MESSAGEBOX_STUB_H #define MESSAGEBOX_STUB_H #include "widgets/messageboxinterface.h" class MessageBoxStub : public Widgets::MessageBoxInterface { public: typedef QSharedPointer Ptr; MessageBoxStub() : m_called(false) {} QMessageBox::Button askConfirmation(QWidget *, const QString &, const QString &) override { m_called = true; return QMessageBox::Yes; } - QString askTextInput(QWidget *, const QString &, const QString &) override { - m_called = true; - return m_textInput; - } - bool called() const { return m_called; } - void setTextInput(const QString &text) { m_textInput = text; } - private: bool m_called; - QString m_textInput; }; #endif