parent
a4c5f2cf95
commit
c486040a3a
7 changed files with 189 additions and 19 deletions
@ -0,0 +1,45 @@ |
||||
/*
|
||||
Copyright (c) 2015 Montel Laurent <montel@kde.org> |
||||
|
||||
This program is free software; you can redistribute it and/or modify it |
||||
under the terms of the GNU General Public License, version 2, as |
||||
published by the Free Software Foundation. |
||||
|
||||
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 "csvwidgettest.h" |
||||
#include "../widgets/csvwidget.h" |
||||
#include <KUrlRequester> |
||||
#include <QLabel> |
||||
#include <qtest_kde.h> |
||||
CsvWidgetTest::CsvWidgetTest(QObject *parent) |
||||
: QObject(parent) |
||||
{ |
||||
|
||||
} |
||||
|
||||
CsvWidgetTest::~CsvWidgetTest() |
||||
{ |
||||
|
||||
} |
||||
|
||||
void CsvWidgetTest::shouldHaveDefaultValue() |
||||
{ |
||||
MailMerge::CsvWidget w; |
||||
|
||||
QLabel *lab = qFindChild<QLabel *>(&w, QLatin1String("label")); |
||||
QVERIFY(lab); |
||||
|
||||
KUrlRequester *urlrequester = qFindChild<KUrlRequester *>(&w, QLatin1String("cvsurlrequester")); |
||||
QVERIFY(urlrequester); |
||||
} |
||||
|
||||
QTEST_KDEMAIN(CsvWidgetTest, GUI) |
||||
@ -0,0 +1,34 @@ |
||||
/*
|
||||
Copyright (c) 2015 Montel Laurent <montel@kde.org> |
||||
|
||||
This program is free software; you can redistribute it and/or modify it |
||||
under the terms of the GNU General Public License, version 2, as |
||||
published by the Free Software Foundation. |
||||
|
||||
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 CSVWIDGETTEST_H |
||||
#define CSVWIDGETTEST_H |
||||
|
||||
#include <QObject> |
||||
|
||||
class CsvWidgetTest : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit CsvWidgetTest(QObject *parent = 0); |
||||
~CsvWidgetTest(); |
||||
|
||||
private Q_SLOTS: |
||||
void shouldHaveDefaultValue(); |
||||
}; |
||||
|
||||
#endif // CSVWIDGETTEST_H
|
||||
@ -0,0 +1,56 @@ |
||||
/*
|
||||
Copyright (c) 2015 Montel Laurent <montel@kde.org> |
||||
|
||||
This program is free software; you can redistribute it and/or modify it |
||||
under the terms of the GNU General Public License, version 2, as |
||||
published by the Free Software Foundation. |
||||
|
||||
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 "csvwidget.h" |
||||
|
||||
#include <KUrlRequester> |
||||
#include <QLabel> |
||||
#include <QVBoxLayout> |
||||
#include <KLocalizedString> |
||||
|
||||
using namespace MailMerge; |
||||
|
||||
CsvWidget::CsvWidget(QWidget *parent) |
||||
: QWidget(parent) |
||||
{ |
||||
QVBoxLayout *csvWidgetLayout = new QVBoxLayout; |
||||
csvWidgetLayout->setMargin(0); |
||||
setLayout(csvWidgetLayout); |
||||
|
||||
QLabel *lab = new QLabel(i18n("Path:")); |
||||
lab->setObjectName(QLatin1String("label")); |
||||
csvWidgetLayout->addWidget(lab); |
||||
mCvsUrlRequester = new KUrlRequester; |
||||
mCvsUrlRequester->setObjectName(QLatin1String("cvsurlrequester")); |
||||
csvWidgetLayout->addWidget(mCvsUrlRequester); |
||||
} |
||||
|
||||
CsvWidget::~CsvWidget() |
||||
{ |
||||
|
||||
} |
||||
|
||||
void CsvWidget::setPath(const KUrl &path) |
||||
{ |
||||
mCvsUrlRequester->setUrl(path); |
||||
} |
||||
|
||||
KUrl CsvWidget::path() const |
||||
{ |
||||
return mCvsUrlRequester->url(); |
||||
} |
||||
|
||||
@ -0,0 +1,41 @@ |
||||
/*
|
||||
Copyright (c) 2015 Montel Laurent <montel@kde.org> |
||||
|
||||
This program is free software; you can redistribute it and/or modify it |
||||
under the terms of the GNU General Public License, version 2, as |
||||
published by the Free Software Foundation. |
||||
|
||||
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 CSVWIDGET_H |
||||
#define CSVWIDGET_H |
||||
|
||||
#include <QWidget> |
||||
|
||||
class KUrlRequester; |
||||
class KUrl; |
||||
namespace MailMerge { |
||||
class CsvWidget : public QWidget |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit CsvWidget(QWidget *parent=0); |
||||
~CsvWidget(); |
||||
|
||||
void setPath(const KUrl &path); |
||||
KUrl path() const; |
||||
|
||||
private: |
||||
KUrlRequester *mCvsUrlRequester; |
||||
}; |
||||
} |
||||
|
||||
#endif // CSVWIDGET_H
|
||||
Loading…
Reference in new issue