From d76ff81b7c1beffef0b84e570914c8f2d47834e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sat, 27 Jul 2013 16:34:45 +0200 Subject: Initial import of tork 0.33 --- src/paranoia.ui.h | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 src/paranoia.ui.h (limited to 'src/paranoia.ui.h') diff --git a/src/paranoia.ui.h b/src/paranoia.ui.h new file mode 100644 index 0000000..4529e49 --- /dev/null +++ b/src/paranoia.ui.h @@ -0,0 +1,209 @@ +/*************************************************************************** + * $Id: paranoia.ui.h,v 1.5 2008/07/31 19:56:26 hoganrobert Exp $ + * Copyright (C) 2006 - 2008 Robert Hogan * + * robert@roberthogan.net * + * * + * 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) any later version. * + * * + * 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 St, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "torkconfig.h" +#include +#include +#include +#include +#include + + +void FilterTable::init() +{ + FilterRules->setSelectionMode( QListView::Extended ); + FilterRules->setColumnWidthMode(0, QListView::Manual); + FilterRules->hideColumn(0); + FilterRules->header()->setResizeEnabled(FALSE, 0); + FilterRules->setResizeMode( QListView::NoColumn ); + + SystemFilterRules->setSelectionMode( QListView::Extended ); + SystemFilterRules->setColumnWidthMode(0, QListView::Manual); + SystemFilterRules->hideColumn(0); + SystemFilterRules->header()->setResizeEnabled(FALSE, 0); + SystemFilterRules->setResizeMode( QListView::NoColumn ); + + QStringList filterRules = TorkConfig::filterRules(); + + QListViewItem *tm; + for ( QStringList::Iterator it = filterRules.begin(); it != filterRules.end(); ++it ) + { + if ((*it).isEmpty()) + continue; + QString active = (*it).section("%:%",0,0); + QString desc = (*it).section("%:%",1,1); + QString entry = (*it).section("%:%",2,2); + + tm = new QListViewItem(FilterRules,active,desc,entry); + + tm->setPixmap( 1, QPixmap(SmallIcon(active ))); + } + + + QStringList systemFilterRules = TorkConfig::systemFilterRules(); + + for ( QStringList::Iterator it = systemFilterRules.begin(); it != systemFilterRules.end(); ++it ) + { + if ((*it).isEmpty()) + continue; + QString active = (*it).section("%:%",0,0); + QString desc = (*it).section("%:%",1,1); + QString entry = (*it).section("%:%",2,2); + + tm = new QListViewItem(SystemFilterRules,active,desc,entry); + + tm->setPixmap( 1, QPixmap(SmallIcon(active ))); + } + + +} + +void FilterTable::pushAdd_clicked() +{ + new QListViewItem(FilterRules,Description->text().replace("%:%",""),Filter->text().replace("%:%","")); + +} + +void FilterTable::pushAdd_Sys_clicked() +{ + new QListViewItem(SystemFilterRules,SystemDescription->text().replace("%:%",""),SystemFilter->text().replace("%:%","")); + +} + + +void FilterTable::FilterRules_contextMenuRequested( QListViewItem *, const QPoint &point, int ) +{ + + QPopupMenu *menu = new QPopupMenu( FilterRules ); + + menu->clear(); + menu->insertItem( "Delete Entry", this,SLOT(slotDeleteEntry()) ); + menu->insertItem( "Toggle Entry", this,SLOT(slotToggleEntry()) ); + + menu->popup( point ); + +} + +void FilterTable::SystemFilterRules_contextMenuRequested( QListViewItem *, const QPoint &point, int ) +{ + + QPopupMenu *menu = new QPopupMenu( SystemFilterRules ); + + menu->clear(); + menu->insertItem( "Delete Entry", this,SLOT(slotDeleteSystemEntry()) ); + menu->insertItem( "Toggle Entry", this,SLOT(slotToggleSystemEntry()) ); + + menu->popup( point ); + +} + + +void FilterTable::slotDeleteEntry( ) +{ + + QListViewItemIterator it(FilterRules, QListViewItemIterator::Selected); + while ( it.current() ) { + if (FilterRules->isSelected( it.current())) + delete it.current(); + ++it; + } + + +} + +void FilterTable::slotToggleEntry( ) +{ + + QListViewItemIterator it(FilterRules, QListViewItemIterator::Selected); + while ( it.current() ) { + if (FilterRules->isSelected( it.current())){ + QString active = "button_cancel"; + if (it.current()->text(0).contains("button_cancel")) + active = "button_ok"; + + it.current()->setText(0,active); + it.current()->setPixmap( 1, QPixmap(SmallIcon(active))); + } + ++it; + } + + +} + +void FilterTable::slotDeleteSystemEntry( ) +{ + + QListViewItemIterator it(SystemFilterRules, QListViewItemIterator::Selected); + while ( it.current() ) { + if (SystemFilterRules->isSelected( it.current())) + delete it.current(); + ++it; + } + + +} + +void FilterTable::slotToggleSystemEntry( ) +{ + + QListViewItemIterator it(SystemFilterRules, QListViewItemIterator::Selected); + while ( it.current() ) { + if (SystemFilterRules->isSelected( it.current())){ + QString active = "button_cancel"; + if (it.current()->text(0).contains("button_cancel")) + active = "button_ok"; + + it.current()->setText(0,active); + it.current()->setPixmap( 1, QPixmap(SmallIcon(active))); + } + ++it; + } + + +} + +// +// +// pushAdd +// clicked() +// FilterTable +// pushAdd_clicked() +// +// +// FilterRules +// contextMenuRequested(QListViewItem*,const QPoint&,int) +// FilterTable +// FilterRules_contextMenuRequested(QListViewItem*,const QPoint&,int) +// +// +// +// firewallsproxies.ui.h +// +// +// pushAdd_clicked() +// FilterRules_contextMenuRequested( QListViewItem *, const QPoint & point, int ) +// slotDeleteEntry() +// +// +// init() +// +// +// -- cgit v1.2.1