summaryrefslogtreecommitdiffstats
path: root/src/commonwidget.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-07-24 11:31:17 -0500
committerTimothy Pearson <[email protected]>2013-07-24 11:31:17 -0500
commitd598a49a3e1cadea0d72be28d147d219686413e7 (patch)
tree3111c0383d0b514f59aaeef0a2f656acc595fd8a /src/commonwidget.cpp
parent56ffa61b35fc088a0e7e2aa885b9ffed82c8d8be (diff)
downloadknmap-d598a49a3e1cadea0d72be28d147d219686413e7.tar.gz
knmap-d598a49a3e1cadea0d72be28d147d219686413e7.zip
Convert to TDE R14 API
Diffstat (limited to 'src/commonwidget.cpp')
-rw-r--r--src/commonwidget.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/commonwidget.cpp b/src/commonwidget.cpp
index e9dbe12..72f9e9b 100644
--- a/src/commonwidget.cpp
+++ b/src/commonwidget.cpp
@@ -20,23 +20,23 @@
* *
***************************************************************************/
-#include <qbuttongroup.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qlistbox.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qstringlist.h>
-#include <qvalidator.h>
-
-#include <kconfig.h>
+#include <ntqbuttongroup.h>
+#include <ntqcheckbox.h>
+#include <ntqcombobox.h>
+#include <ntqlabel.h>
+#include <ntqlayout.h>
+#include <ntqlineedit.h>
+#include <ntqlistbox.h>
+#include <ntqpushbutton.h>
+#include <ntqradiobutton.h>
+#include <ntqstringlist.h>
+#include <ntqvalidator.h>
+
+#include <tdeconfig.h>
#include <kdebug.h>
-#include <kglobal.h>
+#include <tdeglobal.h>
#include <kiconloader.h>
-#include <klocale.h>
+#include <tdelocale.h>
#include <kmessagebox.h>
#include "commonwidget.h"
@@ -45,8 +45,8 @@
// constructor
// ===========
-CommonWidget::CommonWidget( QWidget* parent, const char* name )
-: QWidget( parent, name ),
+CommonWidget::CommonWidget( TQWidget* parent, const char* name )
+: TQWidget( parent, name ),
m_hosts( NULL ),
m_portRangeIgnoreChange( false ),
m_portRanges( NULL )
@@ -73,11 +73,11 @@ bool CommonWidget::buildPortRangesTables( const boolPtr tcpPorts, const boolPtr
{ memset( tcpPorts, 0, 64 * 1024 );
memset( udpPorts, 0, 64 * 1024 );
- QStringList portRanges;
+ TQStringList portRanges;
getPortRanges( &portRanges );
- for( QStringList::Iterator it = portRanges.begin( ); it != portRanges.end( ); ++it )
- { QString portRange = *it;
+ for( TQStringList::Iterator it = portRanges.begin( ); it != portRanges.end( ); ++it )
+ { TQString portRange = *it;
bool tcp = false;
bool udp = false;
@@ -96,11 +96,11 @@ bool CommonWidget::buildPortRangesTables( const boolPtr tcpPorts, const boolPtr
portRange = portRange.right( portRange.length( ) - 2 );
}
else
- { KMessageBox::error( this, i18n( QString( "Internal error - Unknown Port Range protocol '%1'" ).arg( portRange[ 0 ])), i18n( "Internal error" ));
+ { KMessageBox::error( this, i18n( TQString( "Internal error - Unknown Port Range protocol '%1'" ).arg( portRange[ 0 ])), i18n( "Internal error" ));
return false;
}
- QStringList ports = QStringList::split( "-", portRange );
+ TQStringList ports = TQStringList::split( "-", portRange );
if( ports.count( ) > 2 )
{ KMessageBox::error( this, i18n( "Internal error - Illegal Port Range encountered" ), i18n( "Internal error" ));
@@ -129,18 +129,18 @@ bool CommonWidget::buildPortRangesTables( const boolPtr tcpPorts, const boolPtr
// ============
void CommonWidget::createLayout( )
-{ QGridLayout* gridLayout = new QGridLayout( this );
- KIconLoader* iconLoader = KGlobal::iconLoader( );
- QIconSet clearRightIconSet = iconLoader->loadIconSet( "locationbar_erase", KIcon::Small );
+{ TQGridLayout* gridLayout = new TQGridLayout( this );
+ TDEIconLoader* iconLoader = TDEGlobal::iconLoader( );
+ TQIconSet clearRightIconSet = iconLoader->loadIconSet( "locationbar_erase", TDEIcon::Small );
byte row = 1;
- m_hostButton = new QPushButton( clearRightIconSet, NULL, this, "host button" );
- m_hostComboBox = new QComboBox( true, this, "target hosts combobox" );
- QHBoxLayout* hostLayout = new QHBoxLayout( );
+ m_hostButton = new TQPushButton( clearRightIconSet, NULL, this, "host button" );
+ m_hostComboBox = new TQComboBox( true, this, "target hosts combobox" );
+ TQHBoxLayout* hostLayout = new TQHBoxLayout( );
byte col = 0;
hostLayout->insertStretch( col++, 0 );
- hostLayout->insertWidget( col++, new QLabel( i18n( "Target host(s)" ), this, "target hosts label" ), 0 );
+ hostLayout->insertWidget( col++, new TQLabel( i18n( "Target host(s)" ), this, "target hosts label" ), 0 );
hostLayout->insertStretch( col++, 1 );
hostLayout->insertWidget( col++, m_hostButton, 0 );
hostLayout->insertStretch( col++, 1 );
@@ -148,38 +148,38 @@ void CommonWidget::createLayout( )
hostLayout->insertStretch( col++, 0 );
gridLayout->addMultiCellLayout( hostLayout, row, row, 1, 5 );
- QButtonGroup* resloveGroup = new QButtonGroup( 3, Qt::Vertical, i18n( "Resolve names" ), this, "resolve names group" );
- m_resovleDefaultRadio = new QRadioButton( i18n( "Default" ), resloveGroup, "default resolve radio" );
- m_resovleAlwaysRadio = new QRadioButton( i18n( "Always (-R)" ), resloveGroup, "always resolve radio" );
- m_resovleNeverRadio = new QRadioButton( i18n( "Never (-n)" ), resloveGroup, "never resolve radio" );
+ TQButtonGroup* resloveGroup = new TQButtonGroup( 3, TQt::Vertical, i18n( "Resolve names" ), this, "resolve names group" );
+ m_resovleDefaultRadio = new TQRadioButton( i18n( "Default" ), resloveGroup, "default resolve radio" );
+ m_resovleAlwaysRadio = new TQRadioButton( i18n( "Always (-R)" ), resloveGroup, "always resolve radio" );
+ m_resovleNeverRadio = new TQRadioButton( i18n( "Never (-n)" ), resloveGroup, "never resolve radio" );
row = 4;
gridLayout->addMultiCellWidget( resloveGroup, row, row + 3, 1, 1 );
byte rowBlock1 = ++row;
- m_portRangeAddButton = new QPushButton( i18n( "Add" ), this, "add port range button" );
- m_portRangeDeleteButton = new QPushButton( i18n( "Delete" ), this, "delete port range button" );
- m_portRangeComboBox = new QComboBox( this, "port range combobox" );
- m_portRangeLineEdit = new QLineEdit( this, "port range line edit" );
- m_portRangeListBox = new QListBox( this, "port range listbox" );
- m_portRangesCheckBox = new QCheckBox( i18n( "Port ranges (-p <port ranges>)" ), this, "port ranges checkbox" );
+ m_portRangeAddButton = new TQPushButton( i18n( "Add" ), this, "add port range button" );
+ m_portRangeDeleteButton = new TQPushButton( i18n( "Delete" ), this, "delete port range button" );
+ m_portRangeComboBox = new TQComboBox( this, "port range combobox" );
+ m_portRangeLineEdit = new TQLineEdit( this, "port range line edit" );
+ m_portRangeListBox = new TQListBox( this, "port range listbox" );
+ m_portRangesCheckBox = new TQCheckBox( i18n( "Port ranges (-p <port ranges>)" ), this, "port ranges checkbox" );
m_portRangeComboBox->insertItem( i18n( "Both" ), BothProtocol );
m_portRangeComboBox->insertItem( i18n( "TCP" ), TCPProtocol );
m_portRangeComboBox->insertItem( i18n( "UDP" ), UDPProtocol );
- m_portRangeLineEdit->setValidator( new QRegExpValidator( QRegExp( "^\\d{1,5}-{1}\\d{1,5}$" ), this, "port range regx" ));
+ m_portRangeLineEdit->setValidator( new TQRegExpValidator( TQRegExp( "^\\d{1,5}-{1}\\d{1,5}$" ), this, "port range regx" ));
row = 3;
- gridLayout->addMultiCellWidget( m_portRangesCheckBox, row, row, 3, 5, Qt::AlignCenter );
+ gridLayout->addMultiCellWidget( m_portRangesCheckBox, row, row, 3, 5, TQt::AlignCenter );
row++;
- m_portRangeButton = new QPushButton( clearRightIconSet, NULL, this, "host button" );
- QHBoxLayout* portRangeLayout = new QHBoxLayout( );
+ m_portRangeButton = new TQPushButton( clearRightIconSet, NULL, this, "host button" );
+ TQHBoxLayout* portRangeLayout = new TQHBoxLayout( );
col = 0;
portRangeLayout->insertStretch( col++, 0 );
- portRangeLayout->insertWidget( col++, new QLabel( i18n( "New range data: " ), this, "new range data label" ), 0 );
+ portRangeLayout->insertWidget( col++, new TQLabel( i18n( "New range data: " ), this, "new range data label" ), 0 );
portRangeLayout->insertStretch( col++, 1 );
portRangeLayout->insertWidget( col++, m_portRangeButton, 0 );
portRangeLayout->insertStretch( col++, 1 );
@@ -187,7 +187,7 @@ void CommonWidget::createLayout( )
portRangeLayout->insertStretch( col++, 0 );
gridLayout->addMultiCellLayout( portRangeLayout, row, row, 3, 5 );
- gridLayout->addWidget( new QLabel( i18n( "Protocol" ), this, "protocol label" ), row + 1, 3 );
+ gridLayout->addWidget( new TQLabel( i18n( "Protocol" ), this, "protocol label" ), row + 1, 3 );
gridLayout->addWidget( m_portRangeComboBox, row + 2, 3 );
gridLayout->addWidget( m_portRangeAddButton, row + 4, 3 );
gridLayout->addWidget( m_portRangeDeleteButton, row + 5, 3 );
@@ -230,26 +230,26 @@ void CommonWidget::finaliseInitialisation( )
connect( m_hostButton, SIGNAL( clicked( )), SLOT( slotHostButtonClicked( )));
connect( m_hostComboBox, SIGNAL( activated( int )), SLOT( slotHostActivated( int )));
- connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SLOT( slotHostTextChanged( const QString& )));
+ connect( m_hostComboBox, SIGNAL( textChanged( const TQString& )), SLOT( slotHostTextChanged( const TQString& )));
connect( m_portRangeAddButton, SIGNAL( clicked( )), SLOT( slotPortRangeAddClicked( )));
connect( m_portRangeButton, SIGNAL( clicked( )), SLOT( slotPortRangeButtonClicked( )));
connect( m_portRangeDeleteButton, SIGNAL( clicked( )), SLOT( slotPortRangeDeleteClicked( )));
connect( m_portRangeComboBox, SIGNAL( activated( int )), SLOT( slotPortRangeActivated( int )));
- connect( m_portRangeLineEdit, SIGNAL( textChanged( const QString& )), SLOT( slotPortRangeTextChanged( const QString& )));
- connect( m_portRangeListBox, SIGNAL( doubleClicked( QListBoxItem* )), SLOT( slotPortRangeDoubleClicked( QListBoxItem* )));
+ connect( m_portRangeLineEdit, SIGNAL( textChanged( const TQString& )), SLOT( slotPortRangeTextChanged( const TQString& )));
+ connect( m_portRangeListBox, SIGNAL( doubleClicked( TQListBoxItem* )), SLOT( slotPortRangeDoubleClicked( TQListBoxItem* )));
connect( m_portRangeListBox, SIGNAL( highlighted( int )), SLOT( slotPortRangeHighlighted( )));
connect( m_portRangesCheckBox, SIGNAL( clicked( )), SLOT( slotPortRangesClicked( )));
connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( )));
connect( m_hostButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
connect( m_hostComboBox, SIGNAL( activated ( int )), SIGNAL( optionsDirty( )));
- connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
+ connect( m_hostComboBox, SIGNAL( textChanged( const TQString& )), SIGNAL( optionsDirty( )));
connect( m_portRangeAddButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
connect( m_portRangeButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
connect( m_portRangeComboBox, SIGNAL( activated( int )), SIGNAL( optionsDirty( )));
connect( m_portRangeDeleteButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
- connect( m_portRangeLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
- connect( m_portRangeListBox, SIGNAL( doubleClicked( QListBoxItem* )), SIGNAL( optionsDirty( )));
+ connect( m_portRangeLineEdit, SIGNAL( textChanged( const TQString& )), SIGNAL( optionsDirty( )));
+ connect( m_portRangeListBox, SIGNAL( doubleClicked( TQListBoxItem* )), SIGNAL( optionsDirty( )));
connect( m_portRangeListBox, SIGNAL( highlighted ( int )), SIGNAL( optionsDirty( )));
connect( m_portRangesCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
connect( m_resovleAlwaysRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
@@ -258,14 +258,14 @@ void CommonWidget::finaliseInitialisation( )
emit( targetChanged( m_hostComboBox->currentText( )));
}
-QString CommonWidget::getHostName( ) const
+TQString CommonWidget::getHostName( ) const
{ return m_hostComboBox->currentText( );
}
// getHosts
// ========
-void CommonWidget::getHosts( QStringList* hosts )
+void CommonWidget::getHosts( TQStringList* hosts )
{ hosts->clear( );
for( ushort i = 0; i < m_hostComboBox->count( ); i++ )
@@ -276,13 +276,13 @@ void CommonWidget::getHosts( QStringList* hosts )
// ==========
bool CommonWidget::getOptions( )
-{ QStringList portRanges;
+{ TQStringList portRanges;
getPortRanges( &portRanges );
bool portRangesState = m_portRangesCheckBox->isChecked( );
if( portRangesState && portRanges.isEmpty( ))
- { KMessageBox::error( this, i18n( QString( "Port ranges not specified" )), i18n( "Port ranges error" ));
+ { KMessageBox::error( this, i18n( TQString( "Port ranges not specified" )), i18n( "Port ranges error" ));
return false;
}
@@ -297,17 +297,17 @@ bool CommonWidget::getOptions( )
if( m_portRanges != NULL )
delete m_portRanges;
- m_portRanges = new QStringList( portRanges );
+ m_portRanges = new TQStringList( portRanges );
getHosts( m_hosts );
disconnect( m_hostComboBox, SIGNAL( activated( int )), this, SLOT( slotHostActivated( int )));
- disconnect( m_hostComboBox, SIGNAL( textChanged( const QString& )), this, SLOT( slotHostTextChanged( const QString& )));
+ disconnect( m_hostComboBox, SIGNAL( textChanged( const TQString& )), this, SLOT( slotHostTextChanged( const TQString& )));
disconnect( m_hostComboBox, SIGNAL( activated ( int )), this, SIGNAL( optionsDirty( )));
- disconnect( m_hostComboBox, SIGNAL( textChanged( const QString& )), this, SIGNAL( optionsDirty( )));
+ disconnect( m_hostComboBox, SIGNAL( textChanged( const TQString& )), this, SIGNAL( optionsDirty( )));
byte i;
- QStringList::Iterator it;
+ TQStringList::Iterator it;
for( i = 0, it = m_hosts->begin( ); it != m_hosts->end( ); i++, ++it )
if( *it == m_host )
@@ -328,10 +328,10 @@ bool CommonWidget::getOptions( )
m_hosts->prepend( m_host );
connect( m_hostComboBox, SIGNAL( activated( int )), SLOT( slotHostActivated( int )));
- connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SLOT( slotHostTextChanged( const QString& )));
+ connect( m_hostComboBox, SIGNAL( textChanged( const TQString& )), SLOT( slotHostTextChanged( const TQString& )));
connect( m_hostComboBox, SIGNAL( activated ( int )), SIGNAL( optionsDirty( )));
- connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
+ connect( m_hostComboBox, SIGNAL( textChanged( const TQString& )), SIGNAL( optionsDirty( )));
return true;
}
@@ -339,7 +339,7 @@ bool CommonWidget::getOptions( )
// getPortRanges
// =============
-void CommonWidget::getPortRanges( QStringList* portRanges )
+void CommonWidget::getPortRanges( TQStringList* portRanges )
{ portRanges->clear( );
for( ushort i = 0; i < m_portRangeListBox->count( ); i++ )
@@ -376,7 +376,7 @@ bool CommonWidget::portRangesOverlapping( const ushort portFirst, const ushort p
}
uint port;
- QString protocol;
+ TQString protocol;
for( port = portFirst; port <= portLast; port++ )
{ if( tcp && tcpPorts[ port ])
@@ -391,7 +391,7 @@ bool CommonWidget::portRangesOverlapping( const ushort portFirst, const ushort p
}
if( port <= portLast )
- { KMessageBox::sorry( this, i18n( "Overlapping Port Range - %1 port %2" ).arg( protocol ).arg( QString::number( port )), i18n( "Overlapping Port Range" ));
+ { KMessageBox::sorry( this, i18n( "Overlapping Port Range - %1 port %2" ).arg( protocol ).arg( TQString::number( port )), i18n( "Overlapping Port Range" ));
delete [] tcpPorts;
delete [] udpPorts;
return false;
@@ -405,7 +405,7 @@ bool CommonWidget::portRangesOverlapping( const ushort portFirst, const ushort p
// readProfile
// ===========
-void CommonWidget::readProfile( KConfig* config )
+void CommonWidget::readProfile( TDEConfig* config )
{ m_hostCurrentItem = config->readNumEntry( "hostCurrentItem" );
m_portRangeCurrentItem = config->readNumEntry( "portRangeCurrentItem" );
m_portRangesState = config->readBoolEntry( "portRangesState" );
@@ -413,14 +413,14 @@ void CommonWidget::readProfile( KConfig* config )
m_resovleDefaultState = config->readBoolEntry( "resovleDefaultState" );
m_resovleNeverState = config->readBoolEntry( "resovleNeverState" );
- m_hosts = new QStringList( config->readListEntry( "hosts" ));
- m_portRanges = new QStringList( config->readListEntry( "portRanges" ));
+ m_hosts = new TQStringList( config->readListEntry( "hosts" ));
+ m_portRanges = new TQStringList( config->readListEntry( "portRanges" ));
}
// saveProfile
// ===========
-void CommonWidget::saveProfile( KConfig* config )
+void CommonWidget::saveProfile( TDEConfig* config )
{ config->writeEntry( "hostCurrentItem", m_hostCurrentItem );
config->writeEntry( "hosts", *m_hosts );
config->writeEntry( "portRanges", *m_portRanges );
@@ -475,7 +475,7 @@ void CommonWidget::slotHostButtonClicked( )
// slotHostTextChanged
// ===================
-void CommonWidget::slotHostTextChanged( const QString& text )
+void CommonWidget::slotHostTextChanged( const TQString& text )
{ emit( targetChanged( text ));
}
@@ -483,7 +483,7 @@ void CommonWidget::slotHostTextChanged( const QString& text )
// =======================
void CommonWidget::slotPortRangeAddClicked( )
-{ QString text;
+{ TQString text;
if( !validatePortRange( text ))
return;
@@ -534,11 +534,11 @@ void CommonWidget::slotPortRangeButtonClicked( )
// slotPortRangeDoubleClicked
// ==========================
-void CommonWidget::slotPortRangeDoubleClicked( QListBoxItem* item )
+void CommonWidget::slotPortRangeDoubleClicked( TQListBoxItem* item )
{ if( item == NULL )
return;
- QString text = item->text( );
+ TQString text = item->text( );
if( text[ 0 ].isDigit( ))
m_portRangeComboBox->setCurrentItem( BothProtocol );
@@ -584,7 +584,7 @@ void CommonWidget::slotPortRangesClicked( )
// slotPortRangeTextChanged
// ========================
-void CommonWidget::slotPortRangeTextChanged( const QString& /* text */)
+void CommonWidget::slotPortRangeTextChanged( const TQString& /* text */)
{ if( m_portRangeIgnoreChange )
m_portRangeIgnoreChange = false;
else
@@ -613,7 +613,7 @@ void CommonWidget::slotWhatsThisClicked( )
// validatePortRange
// =================
-bool CommonWidget::validatePortRange( QString& text )
+bool CommonWidget::validatePortRange( TQString& text )
{ uint portFirst;
uint portLast;
@@ -629,9 +629,9 @@ bool CommonWidget::validatePortRange( QString& text )
// validatePortRangeText
// =====================
-bool CommonWidget::validatePortRangeText( QString& text, uint& portFirst, uint& portLast )
+bool CommonWidget::validatePortRangeText( TQString& text, uint& portFirst, uint& portLast )
{ text = m_portRangeLineEdit->text( );
- QStringList ports = QStringList::split( "-", text );
+ TQStringList ports = TQStringList::split( "-", text );
if( ports.count( ) > 2 )
{ KMessageBox::error( this, i18n( "Internal error - you seem to have been allowed to entered an illegal Port Range" ), i18n( "Internal error" ));