@ -896,7 +896,7 @@ if you have some ideas, patches, wishes or whatever.
<listitem><para>A XML file named p.e. kmfruleoption_mac_option.xml</para></listitem>
<listitem><para>A XML file named p.e. kmfruleoption_mac_option.xml</para></listitem>
<listitem><para>A desktop file p.e. kmfruleoptionedit_mac.desktop that registeres the plugin within the KDE services framework.</para></listitem>
<listitem><para>A desktop file p.e. kmfruleoptionedit_mac.desktop that registeres the plugin within the KDE services framework.</para></listitem>
<listitem><para>An KParts Plugin component/class that derives form either KMFRuleOptionEditInterface or KMFRuleTargetOptionEditInterface named p.e. KMFRuleOptionEditMAC </para></listitem>
<listitem><para>An KParts Plugin component/class that derives form either KMFRuleOptionEditInterface or KMFRuleTargetOptionEditInterface named p.e. KMFRuleOptionEditMAC </para></listitem>
<listitem><para>A Class deriving from QWidget that may be loaded into the editor view when editing that option.</para>
<listitem><para>A Class deriving from T QWidget that may be loaded into the editor view when editing that option.</para>
<para>Most likely you'll use QTDesigner to design the GUI. If you do this you need to inherit from the generated class.</para></listitem>
<para>Most likely you'll use QTDesigner to design the GUI. If you do this you need to inherit from the generated class.</para></listitem>
</itemizedlist>
</itemizedlist>
</sect2>
</sect2>
@ -1003,17 +1003,17 @@ class KMFRuleEditMac;
class KMFRuleOptionEditMAC : public KMFRuleOptionEditInterface {
class KMFRuleOptionEditMAC : public KMFRuleOptionEditInterface {
TQ_OBJECT
TQ_OBJECT
public:
public:
KMFRuleOptionEditMAC(QObject *parent = 0, const char *name = 0);
KMFRuleOptionEditMAC(T QObject *parent = 0, const char *name = 0);
~KMFRuleOptionEditMAC();
~KMFRuleOptionEditMAC();
void loadRule( IPTRule* rule );
void loadRule( IPTRule* rule );
QWidget* editWidget();
T QWidget* editWidget();
const QString& optionEditName() const;
const T QString& optionEditName() const;
const QString& description() const;
const T QString& description() const;
private slots:
private slots:
void slotAddRuleOption(QString*, QPtrList< QString >* );
void slotAddRuleOption(T QString*, QPtrList< T QString >* );
void slotAddTargetOption(QString*, QPtrList< QString >* );
void slotAddTargetOption(T QString*, QPtrList< T QString >* );
void slotShowOverview();
void slotShowOverview();
private:
private:
@ -1027,11 +1027,11 @@ class TDEInstance;
class KMFRuleOptionEditMACFactory : public KLibFactory {
class KMFRuleOptionEditMACFactory : public KLibFactory {
TQ_OBJECT
TQ_OBJECT
public:
public:
KMFRuleOptionEditMACFactory( QObject *parent = 0, const char *name = 0 );
KMFRuleOptionEditMACFactory( T QObject *parent = 0, const char *name = 0 );
virtual ~KMFRuleOptionEditMACFactory() {
virtual ~KMFRuleOptionEditMACFactory() {
};
};
virtual QObject* createObject( QObject* parent = 0, const char* pname = 0,
virtual T QObject* createObject( T QObject* parent = 0, const char* pname = 0,
const char* name = "QObject",
const char* name = "T QObject",
const QStringList &args = QStringList() );
const QStringList &args = QStringList() );
};
};
@ -1064,7 +1064,7 @@ public:
#include "kmfruleeditmac.h"
#include "kmfruleeditmac.h"
// Constructor get out plugin into a valid state
// Constructor get out plugin into a valid state
KMFRuleOptionEditMAC::KMFRuleOptionEditMAC(QObject *parent, const char *name)
KMFRuleOptionEditMAC::KMFRuleOptionEditMAC(T QObject *parent, const char *name)
: KMFRuleOptionEditInterface(parent, name) {
: KMFRuleOptionEditInterface(parent, name) {
// Initialise the editor class
// Initialise the editor class
@ -1073,11 +1073,11 @@ KMFRuleOptionEditMAC::KMFRuleOptionEditMAC(QObject *parent, const char *name)
m_edit->hide();
m_edit->hide();
// Connect the Signals for the editor class to our slots passing them to the app
// Connect the Signals for the editor class to our slots passing them to the app
connect( m_edit,SIGNAL(sigAddRuleOpt(QString*, QPtrList< QString >* ) ),
connect( m_edit,SIGNAL(sigAddRuleOpt(T QString*, QPtrList< T QString >* ) ),
this,SLOT( slotAddRuleOption(QString*, QPtrList< QString >* ) ) );
this,SLOT( slotAddRuleOption(T QString*, QPtrList< T QString >* ) ) );
//
//
//connect( m_edit,SIGNAL(sigAddTargetOpt(QString*, QPtrList< QString >* ) ),
//connect( m_edit,SIGNAL(sigAddTargetOpt(T QString*, QPtrList< T QString >* ) ),
// this,SLOT( slotAddTargetOption(QString*, QPtrList< QString >* ) ) );
// this,SLOT( slotAddTargetOption(T QString*, QPtrList< T QString >* ) ) );
connect( m_edit,SIGNAL(sigHideMe() ),
connect( m_edit,SIGNAL(sigHideMe() ),
this,SLOT( slotShowOverview() ) );
this,SLOT( slotShowOverview() ) );
}
}
@ -1085,14 +1085,14 @@ KMFRuleOptionEditMAC::KMFRuleOptionEditMAC(QObject *parent, const char *name)
KMFRuleOptionEditMAC::~KMFRuleOptionEditMAC() {}
KMFRuleOptionEditMAC::~KMFRuleOptionEditMAC() {}
// Slot to pass the Signals to the app
// Slot to pass the Signals to the app
void KMFRuleOptionEditMAC::slotAddRuleOption(QString* name, QPtrList< QString >* values ) {
void KMFRuleOptionEditMAC::slotAddRuleOption(T QString* name, QPtrList< T QString >* values ) {
if ( KMFRuleEditInterface* ruleedit = dynamic_cast<KMFRuleEditInterface*> ( parent() ) ) {
if ( KMFRuleEditInterface* ruleedit = dynamic_cast<KMFRuleEditInterface*> ( parent() ) ) {
ruleedit->addRuleOption( name, values );
ruleedit->addRuleOption( name, values );
} else {
} else {
kdDebug() << "KMFRuleOptionEditMAC::slotAddRuleOption(): parent() not of type KMFRuleEditInterface" << endl;
kdDebug() << "KMFRuleOptionEditMAC::slotAddRuleOption(): parent() not of type KMFRuleEditInterface" << endl;
}
}
}
}
void KMFRuleOptionEditMAC::slotAddTargetOption(QString* name, QPtrList< QString >* values ) {
void KMFRuleOptionEditMAC::slotAddTargetOption(T QString* name, QPtrList< T QString >* values ) {
if ( KMFRuleEditInterface* ruleedit = dynamic_cast<KMFRuleEditInterface*> ( parent() ) ) {
if ( KMFRuleEditInterface* ruleedit = dynamic_cast<KMFRuleEditInterface*> ( parent() ) ) {
ruleedit->addRuleTargetOption( name, values );
ruleedit->addRuleTargetOption( name, values );
} else {
} else {
@ -1111,11 +1111,11 @@ void KMFRuleOptionEditMAC::slotShowOverview() {
// Get info for GUI about the plugin
// Get info for GUI about the plugin
const QString& KMFRuleOptionEditMAC::optionEditName() const {
const T QString& KMFRuleOptionEditMAC::optionEditName() const {
return *( new QString( i18n("MAC Option") ) );
return *( new T QString( i18n("MAC Option") ) );
}
}
const QString& KMFRuleOptionEditMAC::description() const {
const T QString& KMFRuleOptionEditMAC::description() const {
return *( new QString( i18n("This plugin manages the MAC address based options of iptables.") ) );
return *( new T QString( i18n("This plugin manages the MAC address based options of iptables.") ) );
}
}
// We must implement this as it is called from the underliening rule editor
// We must implement this as it is called from the underliening rule editor
@ -1129,7 +1129,7 @@ void KMFRuleOptionEditMAC::loadRule( IPTRule* rule ) {
}
}
// return a pointer to our editor widget
// return a pointer to our editor widget
QWidget* KMFRuleOptionEditMAC::editWidget() {
T QWidget* KMFRuleOptionEditMAC::editWidget() {
if ( ! m_edit ) {
if ( ! m_edit ) {
kdDebug() << "KMFRuleOptionEditMAC::editWidget() - m_edit == 0" << endl;
kdDebug() << "KMFRuleOptionEditMAC::editWidget() - m_edit == 0" << endl;
return 0;
return 0;
@ -1145,13 +1145,13 @@ QWidget* KMFRuleOptionEditMAC::editWidget() {
// TDEInstance* KMFRuleOptionEditMACFactory::s_instance = 0L;
// TDEInstance* KMFRuleOptionEditMACFactory::s_instance = 0L;
// TDEAboutData* KMFRuleOptionEditMACFactory::s_about = 0L;
// TDEAboutData* KMFRuleOptionEditMACFactory::s_about = 0L;
KMFRuleOptionEditMACFactory::KMFRuleOptionEditMACFactory( QObject* parent, const char* name )
KMFRuleOptionEditMACFactory::KMFRuleOptionEditMACFactory( T QObject* parent, const char* name )
: KLibFactory( parent, name ) {
: KLibFactory( parent, name ) {
}
}
QObject* KMFRuleOptionEditMACFactory::createObject( QObject* parent, const char* name,
T QObject* KMFRuleOptionEditMACFactory::createObject( T QObject* parent, const char* name,
const char*, const QStringList & ) {
const char*, const QStringList & ) {
QObject * obj = new KMFRuleOptionEditMAC( parent, name );
T QObject * obj = new KMFRuleOptionEditMAC( parent, name );
emit objectCreated( obj );
emit objectCreated( obj );
return obj;
return obj;
}
}
@ -1203,7 +1203,7 @@ class KMFRuleEditMac : public KMyFirewallRuleEditorMac {
TQ_OBJECT
TQ_OBJECT
public:
public:
KMFRuleEditMac( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
KMFRuleEditMac( T QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~KMFRuleEditMac();
~KMFRuleEditMac();
void loadRule( IPTRule* );
void loadRule( IPTRule* );
@ -1223,7 +1223,7 @@ private:
IPTRule* m_rule;
IPTRule* m_rule;
signals:
signals:
void sigAddRuleOpt( QString*, QPtrList<QString>* );
void sigAddRuleOpt( T QString*, QPtrList<T QString>* );
void sigHideMe();
void sigHideMe();
};
};
@ -1280,7 +1280,7 @@ Author: Christian Hubinger <chubinger@gmail.com>, (C) 2001-2004
* The dialog will by default be modeless, unless you set 'modal' to
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
* TRUE to construct a modal dialog.
*/
*/
KMFRuleEditMac::KMFRuleEditMac( QWidget* parent, const char* name, WFlags fl )
KMFRuleEditMac::KMFRuleEditMac( T QWidget* parent, const char* name, WFlags fl )
: KMyFirewallRuleEditorMac( parent, name, fl ) {
: KMyFirewallRuleEditorMac( parent, name, fl ) {
m_err_handler = new KMFErrorHandler( "KMFRuleEditMac" );
m_err_handler = new KMFErrorHandler( "KMFRuleEditMac" );
m_check_input = new KMFCheckInput();
m_check_input = new KMFCheckInput();
@ -1301,7 +1301,7 @@ KMFRuleEditMac::~KMFRuleEditMac() {
* font changes
* font changes
*/
*/
bool KMFRuleEditMac::event( QEvent* ev ) {
bool KMFRuleEditMac::event( QEvent* ev ) {
bool ret = QWidget::event( ev );
bool ret = T QWidget::event( ev );
if ( ev->type() == QEvent::ApplicationFontChange ) {}
if ( ev->type() == QEvent::ApplicationFontChange ) {}
return ret;
return ret;
}
}
@ -1317,13 +1317,13 @@ void KMFRuleEditMac::loadRule( IPTRule * rule ) {
t_src_mac5 ->clear();
t_src_mac5 ->clear();
t_src_mac6 ->clear();
t_src_mac6 ->clear();
m_rule = rule;
m_rule = rule;
QString line = "";
T QString line = "";
IPTRuleOption* opt = 0;
IPTRuleOption* opt = 0;
opt = m_rule->getOptionForName("mac_opt");
opt = m_rule->getOptionForName("mac_opt");
if ( opt ) {
if ( opt ) {
QStringList args = opt->getValues();
QStringList args = opt->getValues();
QString src, dest;
T QString src, dest;
line = *args.at(1);
line = *args.at(1);
if ( line.isEmpty() || line == "UNDEFINED" )
if ( line.isEmpty() || line == "UNDEFINED" )
return;
return;
@ -1332,7 +1332,7 @@ void KMFRuleEditMac::loadRule( IPTRule * rule ) {
c_inv_src_mac->setChecked( true );
c_inv_src_mac->setChecked( true );
}
}
int num = 1;
int num = 1;
QString part = "";
T QString part = "";
c_src_mac->setChecked( true );
c_src_mac->setChecked( true );
while ( !line.isEmpty() ) {
while ( !line.isEmpty() ) {
int pos = -1;
int pos = -1;
@ -1374,21 +1374,21 @@ void KMFRuleEditMac::accept() {
kdDebug() << "KMFRuleEditMac::accept()" << endl;
kdDebug() << "KMFRuleEditMac::accept()" << endl;
m_rule->chain()->table()->kmfDoc()->startTransaction();
m_rule->chain()->table()->kmfDoc()->startTransaction();
m_rule->saveState();
m_rule->saveState();
QString tok1 = t_src_mac1->text().upper();
T QString tok1 = t_src_mac1->text().upper();
QString tok2 = t_src_mac2->text().upper();
T QString tok2 = t_src_mac2->text().upper();
QString tok3 = t_src_mac3->text().upper();
T QString tok3 = t_src_mac3->text().upper();
QString tok4 = t_src_mac4->text().upper();
T QString tok4 = t_src_mac4->text().upper();
QString tok5 = t_src_mac5->text().upper();
T QString tok5 = t_src_mac5->text().upper();
QString tok6 = t_src_mac6->text().upper();
T QString tok6 = t_src_mac6->text().upper();
if ( c_src_mac->isChecked() && ( tok1.isEmpty() || tok2.isEmpty() || tok3.isEmpty() || tok4.isEmpty() || tok5.isEmpty() || tok6.isEmpty() ) ) {
if ( c_src_mac->isChecked() && ( tok1.isEmpty() || tok2.isEmpty() || tok3.isEmpty() || tok4.isEmpty() || tok5.isEmpty() || tok6.isEmpty() ) ) {
const QString & msg = i18n( "One ore more of the fields are empty. Please fill out all fields to define a valid MAC address." );
const T QString & msg = i18n( "One ore more of the fields are empty. Please fill out all fields to define a valid MAC address." );
KMessageBox::error( this, msg );
KMessageBox::error( this, msg );
m_rule->chain()->table()->kmfDoc()->endTransaction();
m_rule->chain()->table()->kmfDoc()->endTransaction();
return ;
return ;
}
}
QString mac = "";
T QString mac = "";
if ( c_src_mac->isChecked() ) {
if ( c_src_mac->isChecked() ) {
mac = tok1 + ":" + tok2 + ":" + tok3 + ":" + tok4 + ":" + tok5 + ":" + tok6;
mac = tok1 + ":" + tok2 + ":" + tok3 + ":" + tok4 + ":" + tok5 + ":" + tok6;
@ -1399,15 +1399,15 @@ void KMFRuleEditMac::accept() {
}
}
}
}
QPtrList<QString>* values = new QPtrList<QString>;
QPtrList<T QString>* values = new QPtrList<T QString>;
QString* op = new QString( "mac_opt" );
T QString* op = new T QString( "mac_opt" );
if ( c_src_mac->isChecked() && !mac.isEmpty() ) {
if ( c_src_mac->isChecked() && !mac.isEmpty() ) {
kdDebug() << "Add new mac option" << endl;
kdDebug() << "Add new mac option" << endl;
QString* src_mac = new QString( mac );
T QString* src_mac = new T QString( mac );
if ( c_inv_src_mac->isChecked() ) {
if ( c_inv_src_mac->isChecked() ) {
src_mac->prepend( "! " );
src_mac->prepend( "! " );
}
}
values->append( new QString( "bool:on" ) );
values->append( new T QString( "bool:on" ) );
values->append( src_mac );
values->append( src_mac );
}
}
emit sigAddRuleOpt( op, values );
emit sigAddRuleOpt( op, values );