Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6545529a authored by Laurent Montel's avatar Laurent Montel 😁

First step to allow to blacklist some baloo completion email

parent b8cae518
......@@ -73,7 +73,13 @@ set(kdepim_addressline_LIB_SRCS
addressline/kmailcompletion.cpp
)
set(kdepim_addressline_blacklist_baloo_LIB_SRCS
addressline/blacklistbaloocompletion/blacklistbalooemailcompletiondialog.cpp
addressline/blacklistbaloocompletion/blacklistbalooemaillist.cpp
)
set(kdepim_LIB_SRCS
${kdepim_addressline_blacklist_baloo_LIB_SRCS}
${kdepim_progresswidget_LIB_SRCS}
${kdepim_job_LIB_SRCS}
${kdepim_widgets_LIB_SRCS}
......@@ -162,3 +168,6 @@ install(FILES ldap/kcmldap.desktop DESTINATION ${SERVICES_INSTALL_DIR})
########### install files ###############
install(FILES interfaces/org.kde.addressbook.service.xml interfaces/org.kde.mailtransport.service.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
add_subdirectory(addressline/blacklistbaloocompletion/autotests)
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
include_directories(
${CMAKE_SOURCE_DIR}/libkdepim
)
set( libkdepim_blacklistbalooemailcompletiondialogtest_SRCS blacklistbalooemailcompletiondialogtest.cpp )
kde4_add_unit_test( libkdepim_blacklistbalooemailcompletiondialogtest ${libkdepim_blacklistbalooemailcompletiondialogtest_SRCS})
target_link_libraries( libkdepim_blacklistbalooemailcompletiondialogtest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} kdepim)
set( libkdepim_blacklistbalooemaillisttest_SRCS blacklistbalooemaillisttest.cpp )
kde4_add_unit_test( libkdepim_blacklistbalooemaillisttest ${libkdepim_blacklistbalooemaillisttest_SRCS})
target_link_libraries( libkdepim_blacklistbalooemaillisttest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} kdepim)
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "blacklistbalooemailcompletiondialogtest.h"
#include "../blacklistbalooemailcompletiondialog.h"
#include <QLabel>
#include <klineedit.h>
#include <qtest_kde.h>
BlackListBalooEmailCompletionDialogTest::BlackListBalooEmailCompletionDialogTest(QObject *parent)
: QObject(parent)
{
}
BlackListBalooEmailCompletionDialogTest::~BlackListBalooEmailCompletionDialogTest()
{
}
void BlackListBalooEmailCompletionDialogTest::shouldHaveDefaultValue()
{
KPIM::BlackListBalooEmailCompletionDialog dlg;
QLabel *searchLabel = qFindChild<QLabel *>(&dlg, QLatin1String("search_label"));
QVERIFY(searchLabel);
KLineEdit *searchLineEdit = qFindChild<KLineEdit *>(&dlg, QLatin1String("search_lineedit"));
QVERIFY(searchLineEdit);
QVERIFY(searchLineEdit->isClearButtonShown());
QVERIFY(searchLineEdit->trapReturnKey());
}
QTEST_KDEMAIN(BlackListBalooEmailCompletionDialogTest, GUI)
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef BLACKLISTBALOOEMAILCOMPLETIONDIALOGTEST_H
#define BLACKLISTBALOOEMAILCOMPLETIONDIALOGTEST_H
#include <QObject>
class BlackListBalooEmailCompletionDialogTest : public QObject
{
Q_OBJECT
public:
explicit BlackListBalooEmailCompletionDialogTest(QObject *parent = 0);
~BlackListBalooEmailCompletionDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // BLACKLISTBALOOEMAILCOMPLETIONDIALOGTEST_H
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "blacklistbalooemaillisttest.h"
#include <qtest_kde.h>
BlackListBalooEmailListTest::BlackListBalooEmailListTest(QObject *parent)
: QObject(parent)
{
}
BlackListBalooEmailListTest::~BlackListBalooEmailListTest()
{
}
QTEST_KDEMAIN(BlackListBalooEmailListTest, GUI)
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef BLACKLISTBALOOEMAILLISTTEST_H
#define BLACKLISTBALOOEMAILLISTTEST_H
#include <QObject>
class BlackListBalooEmailListTest : public QObject
{
Q_OBJECT
public:
explicit BlackListBalooEmailListTest(QObject *parent = 0);
~BlackListBalooEmailListTest();
};
#endif // BLACKLISTBALOOEMAILLISTTEST_H
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "blacklistbalooemailcompletiondialog.h"
#include "blacklistbalooemaillist.h"
#include <KLocalizedString>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <KLineEdit>
using namespace KPIM;
BlackListBalooEmailCompletionDialog::BlackListBalooEmailCompletionDialog(QWidget *parent)
: KDialog(parent)
{
//Add i18n in kf5
setCaption( QLatin1String( "Blacklist Baloo Completion" ) );
setButtons( Ok|Cancel );
setDefaultButton( Ok );
setModal( true );
QWidget *mainWidget = new QWidget( this );
setMainWidget(mainWidget);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainWidget->setLayout(mainLayout);
QHBoxLayout *searchLayout = new QHBoxLayout;
mainLayout->addLayout(searchLayout);
//Add i18n in kf5
QLabel *lab = new QLabel(QLatin1String("Search email:"));
lab->setObjectName(QLatin1String("search_label"));
searchLayout->addWidget(lab);
mSearchLineEdit = new KLineEdit;
mSearchLineEdit->setClearButtonShown(true);
mSearchLineEdit->setTrapReturnKey(true);
mSearchLineEdit->setObjectName(QLatin1String("search_lineedit"));
searchLayout->addWidget(mSearchLineEdit);
mEmailList = new BlackListBalooEmailList;
mEmailList->setObjectName(QLatin1String("email_list"));
mainLayout->addWidget(mEmailList);
connect(this, SIGNAL(okClicked()), this, SLOT(slotSave()));
readConfig();
}
BlackListBalooEmailCompletionDialog::~BlackListBalooEmailCompletionDialog()
{
writeConfig();
}
void BlackListBalooEmailCompletionDialog::readConfig()
{
KConfigGroup group( KGlobal::config(), "BlackListBalooEmailCompletionDialog" );
const QSize sizeDialog = group.readEntry( "Size", QSize(800,600) );
if ( sizeDialog.isValid() ) {
resize( sizeDialog );
}
}
void BlackListBalooEmailCompletionDialog::writeConfig()
{
KConfigGroup group( KGlobal::config(), "BlackListBalooEmailCompletionDialog" );
group.writeEntry( "Size", size() );
}
void BlackListBalooEmailCompletionDialog::slotSave()
{
//TODO
}
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef BLACKLISTBALOOEMAILCOMPLETIONDIALOG_H
#define BLACKLISTBALOOEMAILCOMPLETIONDIALOG_H
#include <KDialog>
#include "kdepim_export.h"
class KLineEdit;
namespace KPIM {
class BlackListBalooEmailList;
class KDEPIM_EXPORT BlackListBalooEmailCompletionDialog : public KDialog
{
Q_OBJECT
public:
explicit BlackListBalooEmailCompletionDialog(QWidget *parent=0);
~BlackListBalooEmailCompletionDialog();
private slots:
void slotSave();
private:
void writeConfig();
void readConfig();
KLineEdit *mSearchLineEdit;
BlackListBalooEmailList *mEmailList;
};
}
#endif // BLACKLISTBALOOEMAILCOMPLETIONDIALOG_H
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "blacklistbalooemaillist.h"
using namespace KPIM;
BlackListBalooEmailList::BlackListBalooEmailList(QWidget *parent)
: QListWidget(parent)
{
}
BlackListBalooEmailList::~BlackListBalooEmailList()
{
}
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef BLACKLISTBALOOEMAILLIST_H
#define BLACKLISTBALOOEMAILLIST_H
#include <QListWidget>
#include "kdepim_export.h"
namespace KPIM {
class KDEPIM_EXPORT BlackListBalooEmailList : public QListWidget
{
Q_OBJECT
public:
explicit BlackListBalooEmailList(QWidget *parent = 0);
~BlackListBalooEmailList();
};
}
#endif // BLACKLISTBALOOEMAILLIST_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment