summaryrefslogtreecommitdiffstats
path: root/wifi/kwifimanager.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /wifi/kwifimanager.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'wifi/kwifimanager.cpp')
-rw-r--r--wifi/kwifimanager.cpp176
1 files changed, 88 insertions, 88 deletions
diff --git a/wifi/kwifimanager.cpp b/wifi/kwifimanager.cpp
index 5e64a683..4267b7ed 100644
--- a/wifi/kwifimanager.cpp
+++ b/wifi/kwifimanager.cpp
@@ -20,14 +20,14 @@
#include <fstream>
// include files for QT
-#include <qdatetime.h>
-#include <qdir.h>
-#include <qlayout.h>
-#include <qtooltip.h>
-#include <qimage.h>
-#include <qbitmap.h>
-#include <qtimer.h>
-#include <qpushbutton.h>
+#include <tqdatetime.h>
+#include <tqdir.h>
+#include <tqlayout.h>
+#include <tqtooltip.h>
+#include <tqimage.h>
+#include <tqbitmap.h>
+#include <tqtimer.h>
+#include <tqpushbutton.h>
// include files for KDE
#include <kapplication.h>
@@ -62,10 +62,10 @@
#define ID_STATUS_MSG 1
-QStringList APs;
+TQStringList APs;
bool useAlternateStrengthCalc;
-KWiFiManagerApp::KWiFiManagerApp (QWidget *, const char *name):
+KWiFiManagerApp::KWiFiManagerApp (TQWidget *, const char *name):
DCOPObject("dcop_interface"), KMainWindow (0, name), device(0), m_shuttingDown(false), m_iconSize( 22 )
{
statistik = 0;
@@ -73,11 +73,11 @@ DCOPObject("dcop_interface"), KMainWindow (0, name), device(0), m_shuttingDown(f
useAlternateStrengthCalc = false;
init_whois_db ();
- QStringList *ignoreInterfaces;
+ TQStringList *ignoreInterfaces;
if (kapp->isRestored())
- ignoreInterfaces = new QStringList();
+ ignoreInterfaces = new TQStringList();
else
- ignoreInterfaces = new QStringList( usedInterfacesList() );
+ ignoreInterfaces = new TQStringList( usedInterfacesList() );
// substitute the following line with a different interface if required
device = new Interface_wireless_wirelessextensions (ignoreInterfaces);
@@ -102,14 +102,14 @@ DCOPObject("dcop_interface"), KMainWindow (0, name), device(0), m_shuttingDown(f
fileDisableRadio->setEnabled (false);
#endif
- counter = new QTimer (this);
- connect (counter, SIGNAL (timeout ()), device, SLOT (poll_device_info()));
+ counter = new TQTimer (this);
+ connect (counter, TQT_SIGNAL (timeout ()), device, TQT_SLOT (poll_device_info()));
counter->start (1000);
- tricorder_trigger = new QTimer ();
- connect (tricorder_trigger, SIGNAL (timeout ()), this,
- SLOT (tricorder_beep ()));
- connect (trayicon, SIGNAL (quitSelected ()), this, SLOT (slotFileQuit ()));
+ tricorder_trigger = new TQTimer ();
+ connect (tricorder_trigger, TQT_SIGNAL (timeout ()), this,
+ TQT_SLOT (tricorder_beep ()));
+ connect (trayicon, TQT_SIGNAL (quitSelected ()), this, TQT_SLOT (slotFileQuit ()));
slotToggleTric(); //set to value saved by KConfig
setAutoSaveSettings();
@@ -143,26 +143,26 @@ void
KWiFiManagerApp::init_whois_db ()
{
KStandardDirs finder;
- QString kdedir =
+ TQString kdedir =
finder.findResourceDir ("data", "kwifimanager/locations/NOWHERE.loc");
kdedir += "kwifimanager/locations/";
- QDir *locations = new QDir (kdedir);
+ TQDir *locations = new TQDir (kdedir);
if (!locations->exists ())
kdDebug () <<
"A grave error occurred while searching for files with AccessPoint information." << endl;
- QStringList *entries = new QStringList (locations->entryList ());
- QString content;
- QString content2;
- for (QStringList::Iterator it = entries->begin (); it != entries->end ();
+ TQStringList *entries = new TQStringList (locations->entryList ());
+ TQString content;
+ TQString content2;
+ for (TQStringList::Iterator it = entries->begin (); it != entries->end ();
it++)
{
if ((*it) != "." && (*it) != "..")
{
- QFile datei (kdedir + (*it));
+ TQFile datei (kdedir + (*it));
datei.open (IO_ReadOnly);
while (datei.readLine (content, 255) != -1)
{
- QString temp (content);
+ TQString temp (content);
content.truncate (content.find (' '));
content = content.upper ();
content2 = temp.right (temp.length () - temp.find (' ') - 1);
@@ -177,14 +177,14 @@ KWiFiManagerApp::init_whois_db ()
}
void
-KWiFiManagerApp::slotLogESSID (QString essid)
+KWiFiManagerApp::slotLogESSID (TQString essid)
{
- QFile log_file( locateLocal( "data", "kwifimanager/kwifimanager.log", true ) );
+ TQFile log_file( locateLocal( "data", "kwifimanager/kwifimanager.log", true ) );
kdDebug() << "Log file is " << log_file.name() << endl;
if (!log_file.open (IO_WriteOnly | IO_Append))
kdDebug () << "Logging failed!" << endl;
- QTextStream stream (&log_file);
- stream << QDateTime::currentDateTime().toString ().latin1 ();
+ TQTextStream stream (&log_file);
+ stream << TQDateTime::currentDateTime().toString ().latin1 ();
stream << " Entering network: " << essid.latin1() << endl;
log_file.close ();
}
@@ -198,13 +198,13 @@ KWiFiManagerApp::slotTXPowerChanged ()
void
KWiFiManagerApp::slotChangeTrayIcon ()
{
- QPixmap* ICON;
+ TQPixmap* ICON;
int sig, noi, str;
double freq = 0.;
bool validdata = device->get_current_quality (sig, noi, str);
if ( settingsUseAlternateCalc->isChecked() ) str = sig - noi;
int mode;
- QLabel sstrength2( i18n("N/A"), 0, 0 );
+ TQLabel sstrength2( i18n("N/A"), 0, 0 );
if ( ( device->get_txpower_disabled() ) || ( !device->get_device_freq ( freq ) ) )
{
@@ -220,49 +220,49 @@ KWiFiManagerApp::slotChangeTrayIcon ()
}
else if (validdata && (str > 45))
{
- sstrength2.setText( QString::number(str) );
+ sstrength2.setText( TQString::number(str) );
ICON = strength->EXCELLENT;
if (led->state == false)
led->On ();
}
else if (validdata && (str > 35))
{
- sstrength2.setText( QString::number(str) );
+ sstrength2.setText( TQString::number(str) );
ICON = strength->EXCELLENT;
if (led->state == false)
led->On ();
}
else if (validdata && (str > 25))
{
- sstrength2.setText( QString::number(str) );
+ sstrength2.setText( TQString::number(str) );
ICON = strength->EXCELLENT;
if (led->state == false)
led->On ();
}
else if (validdata && (str > 15))
{
- sstrength2.setText( QString::number(str) );
+ sstrength2.setText( TQString::number(str) );
ICON = strength->GOOD;
if (led->state == false)
led->On ();
}
else if (validdata && (str > 5))
{
- sstrength2.setText( QString::number(str) );
+ sstrength2.setText( TQString::number(str) );
ICON = strength->MARGINAL;
if (led->state == false)
led->On ();
}
else if (validdata && (str > 0))
{
- sstrength2.setText( QString::number(str) );
+ sstrength2.setText( TQString::number(str) );
ICON = strength->OOR_MINIMUM;
if (led->state == true)
led->Off ();
}
else if (((str == 0) && (mode == 2)) || (!validdata))
{
- sstrength2.setText( QString::fromLatin1("0") );
+ sstrength2.setText( TQString::fromLatin1("0") );
ICON = strength->OOR_DOWN;
if (led->state == true)
led->Off ();
@@ -274,28 +274,28 @@ KWiFiManagerApp::slotChangeTrayIcon ()
led->Off ();
}
- QPixmap temp (m_iconSize+8, m_iconSize+8);
- QPainter bla (&temp);
+ TQPixmap temp (m_iconSize+8, m_iconSize+8);
+ TQPainter bla (&temp);
bla.fillRect (0, 0, m_iconSize+8, m_iconSize+8, backgroundBrush ());
- bla.drawPixmap ( QRect(1, 4, m_iconSize+2,m_iconSize+2), *ICON );
+ bla.drawPixmap ( TQRect(1, 4, m_iconSize+2,m_iconSize+2), *ICON );
if (showStrength) {
- static QFont labelfont ( "Helvetica", 10 );
+ static TQFont labelfont ( "Helvetica", 10 );
- labelfont.setStyleHint( QFont::SansSerif );
- labelfont.setStretch( QFont::Condensed );
+ labelfont.setStyleHint( TQFont::SansSerif );
+ labelfont.setStretch( TQFont::Condensed );
labelfont.setBold( true );
sstrength2.setFont( labelfont );
sstrength2.setFixedSize( sstrength2.sizeHint() );
}
- QPixmap labeltemp = QPixmap::grabWidget( &sstrength2 );
+ TQPixmap labeltemp = TQPixmap::grabWidget( &sstrength2 );
labeltemp.setMask( labeltemp.createHeuristicMask() );
bla.drawPixmap (0, 0, labeltemp );
temp.setMask (temp.createHeuristicMask() );
trayicon->setPixmap ( temp );
this->setIcon( temp );
- QToolTip::add( trayicon, "SSID: "+device->get_essid() );
+ TQToolTip::add( trayicon, "SSID: "+device->get_essid() );
}
void
@@ -305,43 +305,43 @@ KWiFiManagerApp::initActions ()
if (config->hasGroup("General"))
config->setGroup("General");
fileDisableRadio = new KToggleAction (i18n ("&Disable Radio"), 0, this,
- SLOT (slotDisableRadio ()), actionCollection (), "disable_radio");
+ TQT_SLOT (slotDisableRadio ()), actionCollection (), "disable_radio");
fileDisableRadio->setChecked( false );
settingsUseAlternateCalc =
new KToggleAction (i18n ("&Use Alternate Strength Calculation"), 0, this,
- SLOT (slotToggleStrengthCalc ()), actionCollection (), "use_alt_calculation");
+ TQT_SLOT (slotToggleStrengthCalc ()), actionCollection (), "use_alt_calculation");
settingsUseAlternateCalc->setChecked( config->readBoolEntry("useAlternateStrengthCalculation") );
slotToggleStrengthCalc(); //set to value saved by KConfig
settingsShowStatsNoise =
new KToggleAction (i18n ("Show &Noise Graph in Statistics Window"), 0, this,
- SLOT (slotShowStatsNoise ()), actionCollection (), "show_stats_noise");
+ TQT_SLOT (slotShowStatsNoise ()), actionCollection (), "show_stats_noise");
settingsShowStatsNoise->setChecked( config->readBoolEntry("showStatsNoise") );
slotShowStatsNoise(); //set to value saved by KConfig
settingsShowStrengthNumber = new KToggleAction (i18n ("&Show Strength Number in System Tray"), 0, this,
- SLOT (slotToggleShowStrengthNumber ()), actionCollection (), "show_strength_number_in_tray");
+ TQT_SLOT (slotToggleShowStrengthNumber ()), actionCollection (), "show_strength_number_in_tray");
settingsShowStrengthNumber->setChecked( config->readBoolEntry("showStrengthNumberInTray") );
slotToggleShowStrengthNumber (); //set to value saved by KConfig
- KStdAction::quit (this, SLOT (slotFileQuit ()), actionCollection ());
+ KStdAction::quit (this, TQT_SLOT (slotFileQuit ()), actionCollection ());
new KAction (i18n ("Configuration &Editor..."), 0, this,
- SLOT (slotStartConfigEditor ()), actionCollection (), "configuration_editor");
+ TQT_SLOT (slotStartConfigEditor ()), actionCollection (), "configuration_editor");
new KAction (i18n ("Connection &Statistics"), 0, this,
- SLOT (slotStartStatViewer ()), actionCollection (), "connection_statistics");
+ TQT_SLOT (slotStartStatViewer ()), actionCollection (), "connection_statistics");
settingsAcousticScanning = new KToggleAction (i18n ("&Acoustic Scanning"), 0, this,
- SLOT (slotToggleTric ()),
+ TQT_SLOT (slotToggleTric ()),
actionCollection (), "acoustic_scanning");
settingsAcousticScanning->setChecked( config->readBoolEntry("acousticScanning") );
#ifdef WITHOUT_ARTS
settingsAcousticScanning->setEnabled( false);
#endif
settingsStayInSystrayOnClose = new KToggleAction (i18n ("Stay in System &Tray on Close"), 0, this,
- SLOT (slotToggleStayInSystray()),
+ TQT_SLOT (slotToggleStayInSystray()),
actionCollection (), "stay_in_systray_on_close");
settingsStayInSystrayOnClose->setChecked( config->readBoolEntry("stayInSystrayOnClose") );
createGUI();
@@ -357,22 +357,22 @@ KWiFiManagerApp::initView ()
trayicon = new KSystemTray (this);
trayicon->show ();
- view = new QWidget (this, "mainwidget");
+ view = new TQWidget (this, "mainwidget");
view->setBackgroundMode (PaletteBackground);
setCentralWidget (view);
- QGridLayout *zentrallayout = new QGridLayout (view);
+ TQGridLayout *zentrallayout = new TQGridLayout (view);
zentrallayout->setMargin( KDialog::marginHint() );
speedmeter = new Speed (view, device);
status = new Status (view, device);
location = new Locator (view, device);
strength = new Strength (view, device);
pictogram = new Picture (view, device);
- scan = new QPushButton (i18n("Scan for &Networks..."),view);
+ scan = new TQPushButton (i18n("Scan for &Networks..."),view);
slotChangeWindowCaption ();
- QToolTip::add (strength, i18n ("The current signal strength"));
- QToolTip::add (speedmeter, i18n ("The speed at which the wireless LAN card is operating"));
- QToolTip::add (status, i18n ("Detailed connection status"));
- QToolTip::add (scan, i18n ("Performs a scan to discover the networks you can log into"));
+ TQToolTip::add (strength, i18n ("The current signal strength"));
+ TQToolTip::add (speedmeter, i18n ("The speed at which the wireless LAN card is operating"));
+ TQToolTip::add (status, i18n ("Detailed connection status"));
+ TQToolTip::add (scan, i18n ("Performs a scan to discover the networks you can log into"));
pictogram->setMinimumSize (pictogram->mySizeHint());
strength->setMinimumSize (strength->mySizeHint());
speedmeter->setMinimumHeight (60);
@@ -383,20 +383,20 @@ KWiFiManagerApp::initView ()
zentrallayout->addMultiCellWidget (status, 1, 2, 1, 1);
zentrallayout->addWidget (scan, 2, 0);
zentrallayout->addMultiCellWidget (location, 3, 3, 0, 1, Qt::AlignLeft);
- connect (device, SIGNAL (interfaceChanged ()), this, SLOT (slotChangeWindowCaption ()));
- connect (device, SIGNAL (strengthChanged ()), this, SLOT (slotChangeTrayIcon ()));
- connect (device, SIGNAL (strengthChanged ()), strength, SLOT (repaint ()));
- connect (device, SIGNAL (statusChanged ()), status, SLOT (repaint ()));
- connect (device, SIGNAL (speedChanged ()), speedmeter, SLOT (repaint ()));
- connect (device, SIGNAL (modeChanged ()), pictogram, SLOT (repaint ()));
- connect (device, SIGNAL (essidChanged (QString)), this, SLOT (slotLogESSID (QString)));
- connect (device, SIGNAL (essidChanged (QString)), location, SLOT (repaint ()));
- connect (device, SIGNAL (statusChanged ()), location, SLOT (repaint ()));
- connect (device, SIGNAL (txPowerChanged ()), this, SLOT (slotTXPowerChanged ()));
- connect (device, SIGNAL (txPowerChanged ()), this, SLOT (slotChangeTrayIcon ()));
- connect (device, SIGNAL (txPowerChanged ()), pictogram, SLOT (repaint ()));
- connect (device, SIGNAL (txPowerChanged ()), strength, SLOT (repaint ()));
- connect (scan, SIGNAL (clicked()), this, SLOT (slotNetworkScan()));
+ connect (device, TQT_SIGNAL (interfaceChanged ()), this, TQT_SLOT (slotChangeWindowCaption ()));
+ connect (device, TQT_SIGNAL (strengthChanged ()), this, TQT_SLOT (slotChangeTrayIcon ()));
+ connect (device, TQT_SIGNAL (strengthChanged ()), strength, TQT_SLOT (repaint ()));
+ connect (device, TQT_SIGNAL (statusChanged ()), status, TQT_SLOT (repaint ()));
+ connect (device, TQT_SIGNAL (speedChanged ()), speedmeter, TQT_SLOT (repaint ()));
+ connect (device, TQT_SIGNAL (modeChanged ()), pictogram, TQT_SLOT (repaint ()));
+ connect (device, TQT_SIGNAL (essidChanged (TQString)), this, TQT_SLOT (slotLogESSID (TQString)));
+ connect (device, TQT_SIGNAL (essidChanged (TQString)), location, TQT_SLOT (repaint ()));
+ connect (device, TQT_SIGNAL (statusChanged ()), location, TQT_SLOT (repaint ()));
+ connect (device, TQT_SIGNAL (txPowerChanged ()), this, TQT_SLOT (slotTXPowerChanged ()));
+ connect (device, TQT_SIGNAL (txPowerChanged ()), this, TQT_SLOT (slotChangeTrayIcon ()));
+ connect (device, TQT_SIGNAL (txPowerChanged ()), pictogram, TQT_SLOT (repaint ()));
+ connect (device, TQT_SIGNAL (txPowerChanged ()), strength, TQT_SLOT (repaint ()));
+ connect (scan, TQT_SIGNAL (clicked()), this, TQT_SLOT (slotNetworkScan()));
}
void
@@ -427,7 +427,7 @@ KWiFiManagerApp::slotStartStatViewer ()
delete statistik;
statistik = new Statistics (device, showStatsNoise);
statistik->setFixedSize (590, 300);
- connect(device,SIGNAL(statsUpdated()),statistik,SLOT(repaint()));
+ connect(device,TQT_SIGNAL(statsUpdated()),statistik,TQT_SLOT(repaint()));
statistik->show ();
}
@@ -439,13 +439,13 @@ KWiFiManagerApp::slotDisableRadio ()
if ( disablePower != 0 && disablePower->isRunning() ) {
return;
}
- QString interface = device->get_interface_name();
+ TQString interface = device->get_interface_name();
if (interface.isEmpty()) {
return;
}
- QString onOrOff;
+ TQString onOrOff;
if ( fileDisableRadio->isChecked() ) {
onOrOff = "on";
} else {
@@ -460,7 +460,7 @@ KWiFiManagerApp::slotDisableRadio ()
//*disablePower << "kdesu" << "iwconfig" << "eth1" << "txpower" << onOrOff;
*disablePower << "kdesu" << "iwconfig" << interface << "txpower" << onOrOff;
- connect( disablePower, SIGNAL(processExited(KProcess*)), this, SLOT(slotDisablePowerProcessExited()) );
+ connect( disablePower, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(slotDisablePowerProcessExited()) );
disablePower->start(KProcess::NotifyOnExit);
}
@@ -578,7 +578,7 @@ void KWiFiManagerApp::readProperties( KConfig* conf)
else
hide();
- QString dev = conf->readEntry( "wifidevice" );
+ TQString dev = conf->readEntry( "wifidevice" );
if (!dev.isEmpty())
device->setActiveDevice(dev);
}
@@ -605,7 +605,7 @@ KWiFiManagerApp::queryExit()
}
// List of network interfaces used by all running kwifimanager applications
-QStringList usedInterfacesList()
+TQStringList usedInterfacesList()
{
// Register with DCOP
DCOPClient *client = kapp->dcopClient();
@@ -613,19 +613,19 @@ QStringList usedInterfacesList()
client->setDefaultObject( "dcop_interface" );
// shamelessly stolen from kdelibs/kio/booksmarks/kbookmarkimporter_crash.cc
- QStringList ignoreInterfaces;
+ TQStringList ignoreInterfaces;
QCStringList apps = client->registeredApplications();
for ( QCStringList::Iterator it = apps.begin(); it != apps.end(); ++it )
{
- QCString &clientId = *it;
+ TQCString &clientId = *it;
if ( qstrncmp(clientId, "kwifimanager", 12) != 0 )
continue;
DCOPRef ask( clientId, "dcop_interface" );
DCOPReply reply = ask.call( "interface()" );
- QString interface;
+ TQString interface;
if ( reply.isValid() ) {
- QString i = reply;
+ TQString i = reply;
interface = i;
}
if (!interface.isEmpty())