summaryrefslogtreecommitdiffstats
path: root/keep/app/includeexcludedialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'keep/app/includeexcludedialog.cpp')
-rw-r--r--keep/app/includeexcludedialog.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/keep/app/includeexcludedialog.cpp b/keep/app/includeexcludedialog.cpp
new file mode 100644
index 0000000..2759a46
--- /dev/null
+++ b/keep/app/includeexcludedialog.cpp
@@ -0,0 +1,106 @@
+/* This file is part of the Keep project
+ Copyright (C) 2006 Jean-Rémy Falleri <jr.falleri@laposte.net>
+
+ Keep 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) any later version.
+
+ Keep 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 Keep; if not, write to the
+ Free Software Foundation, Inc.,
+ 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "includeexcludedialog.h"
+
+#include <klocale.h>
+#include <qlayout.h>
+#include <kurl.h>
+#include <dcopref.h>
+#include <kdebug.h>
+#include <kactivelabel.h>
+#include <kmimetype.h>
+#include <qpixmap.h>
+#include <kapplication.h>
+#include <kpushbutton.h>
+#include <kiconloader.h>
+#include <qstringlist.h>
+#include <kactionselector.h>
+#include <klistview.h>
+#include <kurlrequester.h>
+
+#include "includeexcludeitem.h"
+
+IncludeExcludeDialog::IncludeExcludeDialog(QWidget *parent):KDialogBase(Plain, i18n("Inclusion/Exclusion Configuration"),
+ Help|Ok, Ok, parent, "includeExcludeDialog", true, false)
+{
+ QGridLayout *topLayout = new QGridLayout(plainPage());
+ m_view = new IncludeExcludeView(plainPage());
+
+ topLayout->addWidget( m_view,0,0 );
+
+ KIconLoader *icons = KGlobal::iconLoader();
+ m_view->remove->setPixmap(icons->loadIcon("remove",KIcon::Toolbar,22));
+
+ m_view->includeExcludeList->setSorting(-1);
+
+ connect(m_view->include,SIGNAL(clicked()),this,SLOT(slotInclude()));
+ connect(m_view->exclude,SIGNAL(clicked()),this,SLOT(slotExclude()));
+ connect(m_view->remove,SIGNAL(clicked()),this,SLOT(slotRemove()));
+
+ resize( QSize(450,450).expandedTo(minimumSizeHint()) );
+}
+
+QStringList IncludeExcludeDialog::includeExcludeList()
+{
+ QStringList includeExcludeList;
+ QListViewItemIterator it( m_view->includeExcludeList );
+ while ( it.current() ) {
+ QListViewItem *item = it.current();
+ IncludeExcludeItem *includeExcludeItem = static_cast<IncludeExcludeItem*>(item);
+ includeExcludeList.append(includeExcludeItem->includeExclude());
+ ++it;
+ }
+ return includeExcludeList;
+}
+
+void IncludeExcludeDialog::setIncludeExcludeList(QStringList includeExcludeList)
+{
+ m_view->includeExcludeList->clear();
+ QStringList::iterator it;
+ IncludeExcludeItem *lastItem;
+ for ( it = includeExcludeList.begin(); it != includeExcludeList.end(); ++it )
+ {
+ if ( it == includeExcludeList.begin() )
+ lastItem = new IncludeExcludeItem(m_view->includeExcludeList,*it);
+ else
+ {
+ IncludeExcludeItem *item = new IncludeExcludeItem(m_view->includeExcludeList,lastItem,*it);
+ lastItem = item;
+ }
+
+ }
+}
+
+void IncludeExcludeDialog::slotInclude()
+{
+ IncludeExcludeItem *item = new IncludeExcludeItem( m_view->includeExcludeList,"I" + m_view->itemURL->url() );
+}
+
+void IncludeExcludeDialog::slotExclude()
+{
+ IncludeExcludeItem *item = new IncludeExcludeItem( m_view->includeExcludeList,"E" + m_view->itemURL->url() );
+}
+
+
+void IncludeExcludeDialog::slotRemove()
+{
+ m_view->includeExcludeList->takeItem(m_view->includeExcludeList->selectedItem());
+}
+
+#include "includeexcludedialog.moc"