summaryrefslogtreecommitdiff
path: root/core/applets
authorchicken <chicken>2004-03-01 16:12:01 (UTC)
committer chicken <chicken>2004-03-01 16:12:01 (UTC)
commit9bc70bb8a0bdd3a7bc0013f2cacce7c039b88b38 (patch) (side-by-side diff)
tree62527c430eb2f6c62ac01c11cdfea06494101a0e /core/applets
parent931c55406a043195712955c732a875e17899df90 (diff)
downloadopie-9bc70bb8a0bdd3a7bc0013f2cacce7c039b88b38.zip
opie-9bc70bb8a0bdd3a7bc0013f2cacce7c039b88b38.tar.gz
opie-9bc70bb8a0bdd3a7bc0013f2cacce7c039b88b38.tar.bz2
fix includes
Diffstat (limited to 'core/applets') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp1
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp2
-rw-r--r--core/applets/cardmon/cardmon.cpp2
-rw-r--r--core/applets/homeapplet/home.cpp2
-rw-r--r--core/applets/irdaapplet/irda.cpp5
-rw-r--r--core/applets/logoutapplet/logout.cpp2
-rw-r--r--core/applets/multikeyapplet/multikey.cpp6
7 files changed, 0 insertions, 20 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index fed9b34..b2cef55 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -1,124 +1,123 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "battery.h"
#include "batterystatus.h"
/* OPIE */
#include <opie2/otaskbarapplet.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/power.h>
-#include <qpe/qpeapplication.h>
/* QT */
#include <qpainter.h>
#include <qtimer.h>
BatteryMeter::BatteryMeter( QWidget *parent )
: QWidget( parent ), charging(false)
{
ps = new PowerStatus;
startTimer( 10000 );
setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) );
setFixedHeight( AppLnk::smallIconSize() );
chargeTimer = new QTimer( this );
connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) );
timerEvent(0);
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
Config c( "qpe" );
c.setGroup( "Battery" );
style = c.readNumEntry( "Style", 0 );
}
BatteryMeter::~BatteryMeter()
{
delete ps;
}
QSize BatteryMeter::sizeHint() const
{
return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() );
}
void BatteryMeter::mousePressEvent( QMouseEvent* e )
{
if ( e->button() == RightButton )
{
style = 1-style;
Config c( "qpe" );
c.setGroup( "Battery" );
c.writeEntry( "Style", style );
repaint( true );
}
QWidget::mousePressEvent( e );
}
void BatteryMeter::mouseReleaseEvent( QMouseEvent* /*e*/ )
{
if ( batteryView && batteryView->isVisible() ) {
delete (QWidget *) batteryView;
} else {
if ( !batteryView ) batteryView = new BatteryStatus( ps );
QPEApplication::showWidget( batteryView );
batteryView->raise();
batteryView->show();
}
}
void BatteryMeter::timerEvent( QTimerEvent * )
{
PowerStatus prev = *ps;
*ps = PowerStatusManager::readStatus();
if ( prev != *ps ) {
percent = ps->batteryPercentRemaining();
if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) {
percent = 0;
charging = true;
chargeTimer->start( 500 );
} else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) {
charging = false;
chargeTimer->stop();
if ( batteryView )
batteryView->updatePercent( percent );
}
repaint( style != 0 );
if ( batteryView )
batteryView->repaint();
}
}
void BatteryMeter::chargeTimeout()
{
percent += 20;
if ( percent > 100 )
percent = 0;
repaint(FALSE);
if ( batteryView )
batteryView->updatePercent( percent );
}
void BatteryMeter::paintEvent( QPaintEvent* )
{
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
index b9ca7b5..ea11495 100644
--- a/core/applets/batteryapplet/batterystatus.cpp
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -1,111 +1,109 @@
#include "batterystatus.h"
/* OPIE */
#include <opie2/odevice.h>
#include <qpe/power.h>
/* QT */
-#include <qpainter.h>
#include <qpushbutton.h>
#include <qdrawutil.h>
#include <qfile.h>
#include <qlayout.h>
#include <qtextstream.h>
-#include <qapplication.h>
#include <qmessagebox.h>
using namespace Opie;
BatteryStatus::BatteryStatus( const PowerStatus *p, QWidget *parent )
: QWidget( parent, 0, WDestructiveClose), ps(p), bat2(false) {
setCaption( tr("Battery status") );
setMinimumSize( 150, 200 );
QPushButton *pb = new QPushButton( tr("Close"), this );
QVBoxLayout *layout = new QVBoxLayout ( this );
jackPercent = 0;
pb->setMaximumSize( 120, 40 );
pb->show();
layout->addStretch();
layout->addWidget( pb );
if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) {
getProcApmStatusIpaq();
}
connect( pb, SIGNAL( clicked() ), this, SLOT( close() ) );
percent = ps->batteryPercentRemaining();
show();
}
BatteryStatus::~BatteryStatus()
{
}
/*
* Make use of the advanced apm interface of the ipaq
*/
bool BatteryStatus::getProcApmStatusIpaq() {
bat2 = false;
QFile procApmIpaq("/proc/hal/battery");
if (procApmIpaq.open(IO_ReadOnly) ) {
QStringList list;
// since it is /proc we _must_ use QTextStream
QTextStream stream ( &procApmIpaq);
QString streamIn;
streamIn = stream.read();
list = QStringList::split("\n", streamIn);
for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) {
// not nice, need a rewrite later
if( (*line).startsWith(" Percentage") ){
if (bat2 == true) {
perc2 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2);
} else {
perc1 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2);
}
}else if( (*line).startsWith(" Life") ){
if (bat2 == true) {
sec2 = (*line).mid(((*line).find(':')+2), 5 );
} else {
sec1 = (*line).mid(((*line).find(':')+2), 5 );
}
}else if( (*line).startsWith("Battery #1") ){
bat2 = true;
}else if( (*line).startsWith(" Status") ){
if (bat2 == true) {
jackStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1);
} else {
ipaqStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1);
}
}else if( (*line).startsWith(" Chemistry") ) {
if (bat2 == true) {
jackChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1);
} else {
ipaqChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1);
}
}
}
} else {
QMessageBox::warning(this, tr("Failure"),tr("could not open file"));
}
procApmIpaq.close();
jackPercent = perc2.toInt();
ipaqPercent = perc1.toInt();
if (perc2.isEmpty()) {
perc2 = tr("no data");
} else {
perc2 += " %";
}
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index 8ffaada..7625545 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -1,127 +1,125 @@
/*
* cardmon.cpp
*
* ---------------------
*
* copyright : (c) 2002 by Maximilian Reiss
* email : max.reiss@gmx.de
* based on two apps by Devin Butterfield
*/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include "cardmon.h"
/* OPIE */
#include <opie2/odevice.h>
#include <opie2/otaskbarapplet.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
/* QT */
-#include <qapplication.h>
#include <qcopchannel_qws.h>
#include <qpainter.h>
-#include <qmessagebox.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qsound.h>
#include <qtimer.h>
/* STD */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
#include <sys/vfs.h>
#include <mntent.h>
#endif
using namespace Opie;
CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ),
pm( Resource::loadPixmap( "cardmon/pcmcia" ) )
{
QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this );
connect( pcmciaChannel,
SIGNAL( received( const QCString &, const QByteArray & ) ), this,
SLOT( cardMessage( const QCString &, const QByteArray & ) ) );
QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this );
connect( sdChannel,
SIGNAL( received( const QCString &, const QByteArray & ) ), this,
SLOT( cardMessage( const QCString &, const QByteArray & ) ) );
cardInPcmcia0 = FALSE;
cardInPcmcia1 = FALSE;
cardInSd = FALSE;
setFocusPolicy( NoFocus );
setFixedWidth ( AppLnk::smallIconSize() );
setFixedHeight ( AppLnk::smallIconSize() );
getStatusPcmcia( TRUE );
getStatusSd( TRUE );
repaint( FALSE );
popupMenu = 0;
}
CardMonitor::~CardMonitor()
{
if ( popupMenu )
{
delete popupMenu;
}
}
void CardMonitor::popUp( QString message, QString icon )
{
if ( !popupMenu )
{
popupMenu = new QPopupMenu( this );
}
popupMenu->clear();
if ( icon.isEmpty() )
{
popupMenu->insertItem( message, 0 );
}
else
{
popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ),
message, 0 );
}
QPoint p = mapToGlobal( QPoint( 0, 0 ) );
QSize s = popupMenu->sizeHint();
popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
p.y() - s.height() ), 0 );
QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) );
}
void CardMonitor::popupTimeout()
{
popupMenu->hide();
}
void CardMonitor::mousePressEvent( QMouseEvent * )
{
QPopupMenu * menu = new QPopupMenu( this );
QString cmd;
int err = 0;
if ( cardInSd )
{
menu->insertItem( QIconSet( Resource::loadPixmap( "cardmon/ide" ) ),
diff --git a/core/applets/homeapplet/home.cpp b/core/applets/homeapplet/home.cpp
index 455575f..8a930be 100644
--- a/core/applets/homeapplet/home.cpp
+++ b/core/applets/homeapplet/home.cpp
@@ -1,87 +1,85 @@
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qapplication.h>
-#include <qiconset.h>
-#include <qpopupmenu.h>
#include "home.h"
HomeApplet::HomeApplet ( )
: QObject ( 0, "HomeApplet" )
{
}
HomeApplet::~HomeApplet ( )
{
}
int HomeApplet::position ( ) const
{
return 4;
}
QString HomeApplet::name ( ) const
{
return tr( "Home shortcut" );
}
QString HomeApplet::text ( ) const
{
return tr( "Desktop" );
}
QString HomeApplet::tr( const char* s ) const
{
return qApp->translate( "HomeApplet", s, 0 );
}
QString HomeApplet::tr( const char* s, const char* p ) const
{
return qApp->translate( "HomeApplet", s, p );
}
QIconSet HomeApplet::icon ( ) const
{
QPixmap pix;
QImage img = Resource::loadImage ( "home" );
if ( !img. isNull ( ))
pix. convertFromImage ( img. smoothScale ( 14, 14 ));
return pix;
}
QPopupMenu *HomeApplet::popup ( QWidget * ) const
{
return 0;
}
void HomeApplet::activated ( )
{
// to desktop (home)
QCopEnvelope ( "QPE/Application/qpe", "raise()" );
}
QRESULT HomeApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
{
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = this;
else if ( uuid == IID_MenuApplet )
*iface = this;
else
return QS_FALSE;
if ( *iface )
(*iface)-> addRef ( );
return QS_OK;
}
Q_EXPORT_INTERFACE( )
{
Q_CREATE_INSTANCE( HomeApplet )
}
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index f850424..a47f33d 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -1,125 +1,120 @@
/**********************************************************************
** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org>
** Max Reiss <harlekin@handhelds.org> [trivial stuff]
** Robert Griebl <sandman@handhelds.org>
** Holger Freyther <zecke@handhelds.org> QCOP Interface
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
-#include <qcopchannel_qws.h>
-#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
-#include <qpe/ir.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qpe/sound.h>
#include <qpainter.h>
#include <qfile.h>
#include <qtimer.h>
#include <qtextstream.h>
-#include <qpopupmenu.h>
#include <unistd.h>
#include <net/if.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include "irda.h"
//===========================================================================
IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
: QWidget ( parent, name )
{
setFixedHeight ( 18 );
setFixedWidth ( 14 );
m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" );
m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" );
m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" );
m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" );
m_irda_active = false;
m_irda_discovery_active = false;
m_receive_active = false;
m_receive_state_changed = false;
m_popup = 0;
m_wasOn = false;
m_wasDiscover = false;
QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) );
}
void IrdaApplet::show()
{
QWidget::show ( );
startTimer ( 2000 );
}
IrdaApplet::~IrdaApplet()
{
if ( m_sockfd >= 0 )
::close ( m_sockfd );
}
void IrdaApplet::popup ( QString message, QString icon )
{
if ( !m_popup )
m_popup = new QPopupMenu ( this );
m_popup-> clear ( );
if ( icon. isEmpty ( ))
m_popup-> insertItem ( message, 0 );
else
m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 );
QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
QSize s = m_popup-> sizeHint ( );
m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
p. y ( ) - s. height ( )));
QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( )));
}
void IrdaApplet::popupTimeout ( )
{
m_popup-> hide ( );
}
bool IrdaApplet::checkIrdaStatus ( )
{
struct ifreq ifr;
strcpy ( ifr. ifr_name, "irda0" );
if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
return false;
return ( ifr. ifr_flags & IFF_UP );
}
bool IrdaApplet::setIrdaStatus ( bool b )
{
struct ifreq ifr;
strcpy ( ifr. ifr_name, "irda0" );
if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
return false;
if ( b ) {
ifr. ifr_flags |= IFF_UP;
diff --git a/core/applets/logoutapplet/logout.cpp b/core/applets/logoutapplet/logout.cpp
index 92222c9..0ac0067 100644
--- a/core/applets/logoutapplet/logout.cpp
+++ b/core/applets/logoutapplet/logout.cpp
@@ -1,102 +1,100 @@
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qapplication.h>
-#include <qiconset.h>
-#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <unistd.h>
#include "logout.h"
LogoutApplet::LogoutApplet ( )
: QObject ( 0, "LogoutApplet" )
{
}
LogoutApplet::~LogoutApplet ( )
{
}
int LogoutApplet::position ( ) const
{
return 0;
}
QString LogoutApplet::name ( ) const
{
return tr( "Logout shortcut" );
}
QString LogoutApplet::text ( ) const
{
return tr( "Logout" );
}
QString LogoutApplet::tr( const char* s ) const
{
return qApp->translate( "LogoutApplet", s, 0 );
}
QString LogoutApplet::tr( const char* s, const char* p ) const
{
return qApp->translate( "LogoutApplet", s, p );
}
QIconSet LogoutApplet::icon ( ) const
{
QPixmap pix;
QImage img = Resource::loadImage ( "logout" );
if ( !img. isNull ( ))
pix. convertFromImage ( img. smoothScale ( 14, 14 ));
return pix;
}
QPopupMenu *LogoutApplet::popup ( QWidget * ) const
{
return 0;
}
// This is a workaround for a Qt bug
// clipboard applet has to stop its poll timer, or Qt/E
// will hang on quit() right before it emits aboutToQuit()
class HackApplication : public QApplication {
public:
HackApplication ( ) : QApplication ( dummy, 0 )
{
}
void emit_about_to_quit ( )
{
emit aboutToQuit ( );
}
int dummy;
};
void LogoutApplet::activated ( )
{
QMessageBox mb ( tr( "Logout" ),
tr( "Do you really want to\nend this session ?" ),
QMessageBox::NoIcon,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No | QMessageBox::Escape,
QMessageBox::NoButton );
mb. setButtonText ( QMessageBox::Yes, "Yes" );
mb. setButtonText ( QMessageBox::No, "No" );
mb. setIconPixmap ( icon ( ). pixmap ( ));
if ( mb. exec ( ) == QMessageBox::Yes ) {
{ QCopEnvelope envelope( "QPE/System", "forceQuit()" ); }
qApp-> processEvents ( ); // ensure the message goes out.
sleep ( 1 ); // You have 1 second to comply.
((HackApplication *) qApp )-> emit_about_to_quit ( );
qApp-> quit();
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index b36ee12..b17498d 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -1,124 +1,118 @@
/**********************************************************************
** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
** All rights reserved.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "multikey.h"
/* OPIE */
#include <opie2/otaskbarapplet.h>
-#include <qpe/global.h>
-#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qpe/qpeapplication.h>
/* QT */
-#include <qlabel.h>
#include <qdir.h>
-#include <qfileinfo.h>
-#include <qcopchannel_qws.h>
Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN")
{
QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this);
connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(message(const QCString &, const QByteArray &)));
setFont( QFont( "Helvetica", 10, QFont::Normal ) );
QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold);
lang = 0;
QCopEnvelope e("MultiKey/Keyboard", "getmultikey()");
setText("EN");
popupMenu.insertItem("EN", 0);
show();
}
void Multikey::mousePressEvent(QMouseEvent *ev)
{
if (!sw_maps.count())
return;
if (ev->button() == RightButton) {
QPoint p = mapToGlobal(QPoint(0, 0));
QSize s = popupMenu.sizeHint();
int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2),
p.y() - s.height()), 0);
if (opt == -1)
return;
lang = opt;
QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
e << sw_maps[lang];
setText(labels[lang]);
}
QWidget::mousePressEvent(ev);
}
void Multikey::mouseReleaseEvent(QMouseEvent *ev)
{
if (!sw_maps.count())
return;
lang = lang < sw_maps.count()-1 ? lang+1 : 0;
QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
//qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii());
e << sw_maps[lang];
setText(labels[lang]);
}
void Multikey::message(const QCString &message, const QByteArray &data)
{
if ( message == "setsw(QString,QString)" ) {
QDataStream stream(data, IO_ReadOnly);
QString maps, current_map;
stream >> maps >> current_map;
QStringList sw = QStringList::split(QChar('|'), maps);
sw.append(current_map);
QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap");
lang = 0;
labels.clear();
sw_maps.clear();
popupMenu.clear();
for (uint i = 0; i < sw.count(); ++i) {
QString keymap_map;
if (sw[i][0] != '/') {
keymap_map = map_dir.absPath() + "/" + sw[i];
} else {
if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false)
&& i != sw.count()-1) || !QFile::exists(sw[i])) {
continue;
}
keymap_map = sw[i];
}
QFile map(keymap_map);
if (map.open(IO_ReadOnly)) {
QString line;
map.readLine(line, 1024);
while (!map.atEnd()) {
if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) {
if (i != sw.count()-1) {
if (keymap_map == current_map) {
lang = i;
}
sw_maps.append(keymap_map);
labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());