summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-14 17:37:48 (UTC)
committer zecke <zecke>2004-03-14 17:37:48 (UTC)
commitd69b11f67e3118f86d068c38c422984d754e13cc (patch) (side-by-side diff)
tree9733e26ab49003bead06d820d70a14babd0c09f0
parent64820b76cc9d1c06a6967cd34114f3b95896aaeb (diff)
downloadopie-d69b11f67e3118f86d068c38c422984d754e13cc.zip
opie-d69b11f67e3118f86d068c38c422984d754e13cc.tar.gz
opie-d69b11f67e3118f86d068c38c422984d754e13cc.tar.bz2
Updatet the applets
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp8
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp2
-rw-r--r--core/applets/batteryapplet/config.in2
-rw-r--r--core/applets/cardmon/cardmon.cpp1
-rw-r--r--core/applets/cardmon/config.in2
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp7
-rw-r--r--core/applets/clipboardapplet/config.in2
-rw-r--r--core/applets/clockapplet/clock.cpp7
-rw-r--r--core/applets/clockapplet/config.in2
-rw-r--r--core/applets/homeapplet/config.in2
-rw-r--r--core/applets/irdaapplet/config.in2
-rw-r--r--core/applets/irdaapplet/irda.cpp6
-rw-r--r--core/applets/logoutapplet/config.in2
-rw-r--r--core/applets/multikeyapplet/multikey.cpp7
-rw-r--r--core/applets/restartapplet/config.in2
-rw-r--r--core/applets/rotateapplet/config.in2
-rw-r--r--core/applets/rotateapplet/rotate.cpp4
-rw-r--r--core/applets/rotateapplet/rotateapplet.pro2
-rw-r--r--core/applets/screenshotapplet/config.in2
-rw-r--r--core/applets/screenshotapplet/inputDialog.cpp3
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp7
-rw-r--r--core/applets/suspendapplet/config.in2
-rw-r--r--core/applets/vmemo/config.in2
-rw-r--r--core/applets/vmemo/vmemo.cpp7
-rw-r--r--core/applets/volumeapplet/config.in2
-rw-r--r--core/applets/volumeapplet/volume.cpp8
-rw-r--r--core/applets/volumeapplet/volumeapplet.pro2
-rw-r--r--core/applets/vtapplet/config.in2
-rw-r--r--core/obex/config.in2
-rw-r--r--core/obex/obex.cc19
-rw-r--r--core/obex/obex.h10
-rw-r--r--core/obex/obex.pro4
-rw-r--r--core/obex/obeximpl.cpp2
33 files changed, 66 insertions, 70 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index b2cef55..18e368e 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -1,81 +1,84 @@
/**********************************************************************
** 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/qpeapplication.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/power.h>
/* QT */
#include <qpainter.h>
#include <qtimer.h>
+using namespace Opie::Ui;
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 );
@@ -130,53 +133,50 @@ void BatteryMeter::paintEvent( QPaintEvent* )
p.setFont( f );
p.drawText( 0, height()/2, QString::number( percent ) );
p.drawText( width()/4, height(), "%" );
return;
}
QPainter p(this);
QColor color;
QColor g = gray.light( 160 );
switch ( ps->acStatus() )
{
case PowerStatus::Offline: color = blue.light( 150 ); break;
case PowerStatus::Online: color = green.dark( 130 ).light( 180 ); break;
default: color = red.light( 160 );
}
int w = height() / 2;
if ( !(w%2) ) w--; // should have an odd value to get a real middle line
int h = height() - 4;
int pix = (percent * h) / 100;
int y2 = height() -2;
int y = y2 - pix;
int x1 = (width() - w ) / 2;
p.setPen(QColor(80,80,80));
p.drawLine(x1+w/4,0,x1+w/4+w/2+1,0); // header
p.drawRect(x1,1,w,height()-1); // corpus
p.setBrush(color);
//int extra = ((percent * h) % 100)/(100/4);
int middle = w/2;
for ( int i = 0; i < middle; i++ )
{
p.setPen( gray.dark( 100+i*20 ) );
p.drawLine( x1+middle-i, 2, x1+middle-i, y-1 );
p.drawLine( x1+middle+i, 2, x1+middle+i, y-1 );
p.setPen( color.dark( 100+i*20 ) );
p.drawLine( x1+middle-i, y, x1+middle-i, y2 );
p.drawLine( x1+middle+i, y, x1+middle+i, y2 );
}
}
int BatteryMeter::position()
{
return 8;
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<BatteryMeter> );
-}
+EXPORT_OPIE_APPLET_v1( BatteryMeter )
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
index ea11495..bd86f77 100644
--- a/core/applets/batteryapplet/batterystatus.cpp
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -1,64 +1,64 @@
#include "batterystatus.h"
/* OPIE */
#include <opie2/odevice.h>
#include <qpe/power.h>
/* QT */
#include <qpushbutton.h>
#include <qdrawutil.h>
#include <qfile.h>
#include <qlayout.h>
#include <qtextstream.h>
#include <qmessagebox.h>
-using namespace Opie;
+using namespace Opie::Core;
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++) {
diff --git a/core/applets/batteryapplet/config.in b/core/applets/batteryapplet/config.in
index 3067317..eca07e3 100644
--- a/core/applets/batteryapplet/config.in
+++ b/core/applets/batteryapplet/config.in
@@ -1,4 +1,4 @@
config BATTERYAPPLET
boolean "opie-batteryapplet (Applet to monitor battery status)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index 6090b68..ed4bfc7 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -2,96 +2,97 @@
* 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 <qcopchannel_qws.h>
#include <qpainter.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;
using namespace Opie::Ui;
+using namespace Opie::Ui;
using namespace Opie::Core;
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() )
diff --git a/core/applets/cardmon/config.in b/core/applets/cardmon/config.in
index f3d57fd..8626c75 100644
--- a/core/applets/cardmon/config.in
+++ b/core/applets/cardmon/config.in
@@ -1,4 +1,4 @@
config CARDMON
boolean "opie-cardmon (monitor cf/sd/mmc card status, and eject function)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 4fc8076..57a4088 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -1,84 +1,85 @@
/**********************************************************************
** 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 "clipboard.h"
#include <opie2/otaskbarapplet.h>
#include <qpe/resource.h>
#include <qpe/applnk.h>
#include <qpainter.h>
#include <qpopupmenu.h>
#include <qwindowsystem_qws.h>
#include <qapplication.h>
#include <qclipboard.h>
#include <qtimer.h>
//===========================================================================
+using namespace Opie::Ui;
ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
{
setFixedWidth ( AppLnk::smallIconSize() );
setFixedHeight ( AppLnk::smallIconSize() );
QImage img = Resource::loadImage( "paste");
img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
m_clipboardPixmap.convertFromImage( img );
m_timer = new QTimer ( this );
connect ( QApplication::clipboard ( ), SIGNAL( dataChanged()), this, SLOT( newData()));
connect ( m_timer, SIGNAL( timeout()), this, SLOT( newData()));
connect ( qApp, SIGNAL( aboutToQuit()), this, SLOT( shutdown()));
m_menu = 0;
m_dirty = true;
m_lasttext = QString::null;
m_timer-> start ( 0, true );
}
ClipboardApplet::~ClipboardApplet ( )
{
}
int ClipboardApplet::position()
{
return 6;
}
void ClipboardApplet::shutdown ( )
{
// the timer has to be stopped, or Qt/E will hang on quit()
// see launcher/desktop.cpp
m_timer-> stop ( );
}
void ClipboardApplet::mousePressEvent ( QMouseEvent *)
{
if ( m_dirty ) {
delete m_menu;
m_menu = new QPopupMenu ( this );
m_menu-> setCheckable ( true );
@@ -138,52 +139,50 @@ void ClipboardApplet::action(int id)
unicode = 'V' - '@';
scan = Key_V;
}
break;
}
if ( scan ) {
qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false );
qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false );
}
}
void ClipboardApplet::paintEvent ( QPaintEvent* )
{
QPainter p ( this );
/* center the height but our pixmap is as big as the height ;)*/
p. drawPixmap( 0, 0,
m_clipboardPixmap );
}
void ClipboardApplet::newData ( )
{
static bool excllock = false;
if ( excllock )
return;
else
excllock = true;
m_timer-> stop ( );
QCString type = "plain";
QString txt = QApplication::clipboard ( )-> text ( type );
if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) {
m_history. append ( txt );
if ( m_history. count ( ) > 5 )
m_history. remove ( m_history. begin ( ));
m_dirty = true;
}
m_timer-> start ( 1500, true );
excllock = false;
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ClipboardApplet> );
-}
+EXPORT_OPIE_APPLET_v1( ClipboardApplet )
+
diff --git a/core/applets/clipboardapplet/config.in b/core/applets/clipboardapplet/config.in
index 1205b26..e58d239 100644
--- a/core/applets/clipboardapplet/config.in
+++ b/core/applets/clipboardapplet/config.in
@@ -1,4 +1,4 @@
config CLIPBOARDAPPLET
boolean "opie-clipboardapplet (copy/cut/paste applet)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp
index 120a019..3b13d74 100644
--- a/core/applets/clockapplet/clock.cpp
+++ b/core/applets/clockapplet/clock.cpp
@@ -1,121 +1,120 @@
/**********************************************************************
** 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 "clock.h"
#include <opie2/otaskbarapplet.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
+using namespace Opie::Ui;
LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent )
{
// If you want a sunken border around the clock do this:
// setFrameStyle( QFrame::Panel | QFrame::Sunken );
//setFont( QFont( "Helvetica", , QFont::Normal ) );
connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) );
connect( qApp, SIGNAL( clockChanged(bool) ),
this, SLOT( slotClockChanged(bool) ) );
readConfig();
timerId = 0;
timerEvent( 0 );
show();
}
int LauncherClock::position()
{
return 10;
}
void LauncherClock::readConfig() {
Config config( "qpe" );
config.setGroup( "Time" );
ampmFormat = config.readBoolEntry( "AMPM", TRUE );
config.setGroup( "Date" );
format = config.readNumEntry("ClockApplet",0);
}
void LauncherClock::mouseReleaseEvent( QMouseEvent * )
{
QCString setTimeApp;
setTimeApp="systemtime";
QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()");
}
void LauncherClock::timerEvent( QTimerEvent *e )
{
if ( !e || e->timerId() == timerId ) {
killTimer( timerId );
changeTime();
QTime t = QTime::currentTime();
int ms = (60 - t.second())*1000 - t.msec();
timerId = startTimer( ms );
} else {
QLabel::timerEvent( e );
}
}
void LauncherClock::updateTime( void )
{
changeTime();
}
void LauncherClock::changeTime( void )
{
QTime tm = QDateTime::currentDateTime().time();
QString s;
if( ampmFormat ) {
int hour = tm.hour();
if (hour == 0)
hour = 12;
if (hour > 12)
hour -= 12;
s.sprintf( "%2d:%02d %s", hour, tm.minute(),
(tm.hour() >= 12) ? "PM" : "AM" );
} else
s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
if (format==1) {
QDate dm = QDate::currentDate();
QString d;
d.sprintf("%d/%d ", dm.day(), dm.month());
setText( d+s );
} else if (format==2) {
QDate dm = QDate::currentDate();
QString d;
d.sprintf("%d/%d ", dm.month(), dm.day());
setText( d+s );
} else {
setText( s );
}
}
void LauncherClock::slotClockChanged( bool pm )
{
readConfig();
updateTime();
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<LauncherClock> );
-}
+
+EXPORT_OPIE_APPLET_v1( LauncherClock )
diff --git a/core/applets/clockapplet/config.in b/core/applets/clockapplet/config.in
index 20bd39d..6c32f79 100644
--- a/core/applets/clockapplet/config.in
+++ b/core/applets/clockapplet/config.in
@@ -1,4 +1,4 @@
config CLOCKAPPLET
boolean "opie-clockapplet (Digital clock applet)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/homeapplet/config.in b/core/applets/homeapplet/config.in
index 1828da0..53d7882 100644
--- a/core/applets/homeapplet/config.in
+++ b/core/applets/homeapplet/config.in
@@ -1,4 +1,4 @@
config HOMEAPPLET
boolean "Home"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/irdaapplet/config.in b/core/applets/irdaapplet/config.in
index 56ec664..0976e8f 100644
--- a/core/applets/irdaapplet/config.in
+++ b/core/applets/irdaapplet/config.in
@@ -1,4 +1,4 @@
config IRDAAPPLET
boolean "opie-irdaapplet (applet for IR beaming/discovery)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index dde8050..2196d18 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -1,87 +1,88 @@
/**********************************************************************
** 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 "irda.h"
/* OPIE */
#include <opie2/otaskbarapplet.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
/* QT */
#include <qpainter.h>
#include <qfile.h>
#include <qtimer.h>
#include <qtextstream.h>
/* STD */
#include <unistd.h>
#include <net/if.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
//===========================================================================
+using namespace Opie::Ui;
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&) ) );
}
int IrdaApplet::position()
{
return 6;
}
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 );
@@ -314,52 +315,49 @@ void IrdaApplet::timerEvent ( QTimerEvent * )
void IrdaApplet::paintEvent ( QPaintEvent * )
{
QPainter p ( this );
p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap );
if ( m_irda_discovery_active )
p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap );
if ( m_receive_active )
p. drawPixmap( 0, 1, m_receiveActivePixmap );
}
/*
* We know 3 calls
* a) enable
* b) disable
* a and b will temp enable the IrDa device and disable will disable it again if it wasn't on
* c) listDevices: We will return a list of known devices
*/
void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) {
if ( str == "enableIrda()") {
m_wasOn = checkIrdaStatus();
m_wasDiscover = checkIrdaDiscoveryStatus();
if (!m_wasOn) {
setIrdaStatus( true );
}
if ( !m_wasDiscover ) {
setIrdaDiscoveryStatus ( true );
}
} else if ( str == "disableIrda()") {
if (!m_wasOn) {
setIrdaStatus( false );
}
if ( !m_wasDiscover ) {
setIrdaDiscoveryStatus ( false );
}
} else if ( str == "listDevices()") {
QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)");
QStringList list;
QMap<QString, QString>::Iterator it;
for (it = m_devices.begin(); it != m_devices.end(); ++it )
list << (*it);
e << list;
}
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<IrdaApplet> );
-}
+EXPORT_OPIE_APPLET_v1( IrdaApplet )
diff --git a/core/applets/logoutapplet/config.in b/core/applets/logoutapplet/config.in
index 385b02f..0d48c6a 100644
--- a/core/applets/logoutapplet/config.in
+++ b/core/applets/logoutapplet/config.in
@@ -1,4 +1,4 @@
config LOGOUTAPPLET
boolean "Logout"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index fc5f093..195ada5 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -1,71 +1,73 @@
/**********************************************************************
** 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/qcopenvelope_qws.h>
+#include <qpe/qpeapplication.h>
/* QT */
#include <qdir.h>
+using namespace Opie::Ui;
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]);
@@ -92,52 +94,49 @@ void Multikey::message(const QCString &message, const QByteArray &data)
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());
popupMenu.insertItem(labels[labels.count()-1], labels.count()-1);
} else {
current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace();
}
break;
}
map.readLine(line, 1024);
}
map.close();
}
}
setText(current);
}
}
int Multikey::position()
{
return 10;
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<Multikey> );
-}
+EXPORT_OPIE_APPLET_v1( Multikey )
diff --git a/core/applets/restartapplet/config.in b/core/applets/restartapplet/config.in
index aa2580f..764ae58 100644
--- a/core/applets/restartapplet/config.in
+++ b/core/applets/restartapplet/config.in
@@ -1,4 +1,4 @@
config RESTARTAPPLET
boolean "opie-restartapplet (Restart Opie via taskbar)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/rotateapplet/config.in b/core/applets/rotateapplet/config.in
index 1a0d923..d3de89a 100644
--- a/core/applets/rotateapplet/config.in
+++ b/core/applets/rotateapplet/config.in
@@ -1,4 +1,4 @@
config ROTATEAPPLET
boolean "Rotate"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index 0488c36..f621aa9 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -1,87 +1,87 @@
/*
This file is part of the OPIE Project
Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org>
Copyright (C) 2003 Greg Gilbert <ggilbert@treke.net>
               =. Copyright (C) 2004 Michael Lauer <mickey@Vanille.de>
             .=l.
           .>+-=
 _;:,     .>    :=|. This library is free software; you can
.> <,   >  .   <= redistribute it and/or modify it under
:=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%+i>       _;_.
    .i_,=:_.      -<s. This library 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
..}^=.=       =       ; Library General Public License for more
++=   -.     .     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-= this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "rotate.h"
/* OPIE */
-#include <opie/odevice.h>
+#include <opie2/odevice.h>
#include <qpe/config.h>
#include <qpe/power.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
-using namespace Opie;
+using namespace Opie::Core;
/* QT */
#include <time.h>
RotateApplet::RotateApplet()
:QObject( 0, "RotateApplet" ), m_flipped( false )
{
#if !defined(QT_NO_COP)
QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this );
connect ( rotateChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) );
#endif
}
RotateApplet::~RotateApplet ( )
{}
/**
* Qcop receive method.
*/
void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data )
{
qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg );
if ( ODevice::inst()->hasHingeSensor() )
{
struct timespec interval;
struct timespec remain;
interval.tv_sec = 0;
interval.tv_nsec = 600000;
::nanosleep( &interval, &remain );
OHingeStatus status = ODevice::inst()->readHingeSensor();
qDebug( "RotateApplet::readHingeSensor = %d", (int) status );
Config cfg( "apm" );
cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" );
int action = cfg.readNumEntry( "CloseHingeAction", 0 );
if ( status == CASE_CLOSED )
{
switch ( action )
{
case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break;
case 2: /* SUSPEND */ ODevice::inst()->suspend(); break;
default: /* IGNORE */ break;
diff --git a/core/applets/rotateapplet/rotateapplet.pro b/core/applets/rotateapplet/rotateapplet.pro
index f24682c..7a4420f 100644
--- a/core/applets/rotateapplet/rotateapplet.pro
+++ b/core/applets/rotateapplet/rotateapplet.pro
@@ -1,13 +1,13 @@
TEMPLATE = lib
CONFIG += qt plugn warn_on release
HEADERS = rotate.h
SOURCES = rotate.cpp
TARGET = rotateapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe
+LIBS += -lqpe -lopiecore2
VERSION = 1.0.0
include ( $(OPIEDIR)/include.pro )
target.path = $$prefix/plugins/applets
diff --git a/core/applets/screenshotapplet/config.in b/core/applets/screenshotapplet/config.in
index cafd470..98f2b61 100644
--- a/core/applets/screenshotapplet/config.in
+++ b/core/applets/screenshotapplet/config.in
@@ -1,4 +1,4 @@
config SCREENSHOTAPPLET
boolean "opie-screenshotapplet (create images from your current display)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/screenshotapplet/inputDialog.cpp b/core/applets/screenshotapplet/inputDialog.cpp
index 73ec773..ce03ec0 100644
--- a/core/applets/screenshotapplet/inputDialog.cpp
+++ b/core/applets/screenshotapplet/inputDialog.cpp
@@ -1,64 +1,65 @@
/****************************************************************************
** Form implementation generated from reading ui file 'inputDialog.ui'
**
** Created: Sat Mar 2 07:55:03 2002
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "inputDialog.h"
#include <qpe/resource.h>
#include <opie2/ofiledialog.h>
#include <qlineedit.h>
#include <qpushbutton.h>
+using namespace Opie::Ui;
InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "InputDialog" );
resize( 234, 115);
setMaximumSize( QSize( 240, 40));
setCaption( tr(name ) );
QPushButton *browserButton;
browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
browserButton->setGeometry( QRect( 205, 10, 22, 22));
connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
LineEdit1 = new QLineEdit( this, "LineEdit1" );
LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
}
/*
* Destroys the object and frees any allocated resources
*/
InputDialog::~InputDialog()
{
inputText= LineEdit1->text();
}
void InputDialog::browse() {
MimeTypes types;
QStringList audio, video, all;
audio << "audio/*";
audio << "playlist/plain";
audio << "audio/x-mpegurl";
video << "video/*";
video << "playlist/plain";
all += audio;
all += video;
types.insert("All Media Files", all );
types.insert("Audio", audio );
types.insert("Video", video );
- QString str = Opie::OFileDialog::getOpenFileName( 1,"/","", types, 0 );
+ QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/","", types, 0 );
LineEdit1->setText(str);
}
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 20e1c9b..9aa012a 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -1,89 +1,90 @@
/**********************************************************************
** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com
** 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 "screenshot.h"
#include "inputDialog.h"
/* OPIE */
#include <opie2/otaskbarapplet.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
/* QT */
#include <qlineedit.h>
#include <qdir.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qpainter.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qcheckbox.h>
#include <qmessagebox.h>
/* STD */
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
/* XPM */
+using namespace Opie::Ui;
static char * snapshot_xpm[] = {
"32 32 177 2",
" c None",
". c #042045",
"+ c #0D2B47",
"@ c #0E325E",
"# c #0D2E50",
"$ c #0A1C32",
"% c #0F3A69",
"& c #164680",
"* c #165EAE",
"= c #134D89",
"- c #0A3A6E",
"; c #031024",
"> c #031B36",
", c #1A5EA3",
"' c #1862B1",
") c #1866B9",
"! c #0F5AAC",
"~ c #0F56A8",
"{ c #0C4C96",
"] c #030918",
"^ c #060206",
"/ c #20242C",
"( c #3E3B3B",
"_ c #186ABD",
": c #115EB3",
"< c #082644",
"[ c #222C38",
"} c #5A5859",
"| c #091921",
"1 c #1E7EDE",
"2 c #1A7ADA",
"3 c #1970CD",
"4 c #1758A1",
"5 c #0E529A",
"6 c #094388",
"7 c #22364E",
"8 c #384454",
"9 c #04162C",
"0 c #123451",
"a c #3296B4",
"b c #298AB1",
"c c #2484AC",
"d c #033D86",
"e c #033677",
"f c #072C58",
"g c #525862",
@@ -491,53 +492,51 @@ ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name )
{
setFixedWidth( AppLnk::smallIconSize());
QImage img = (const char **)snapshot_xpm;
img = img.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize());
m_icon.convertFromImage(img);
}
ScreenshotApplet::~ScreenshotApplet()
{
}
int ScreenshotApplet::position()
{
return 6;
}
void ScreenshotApplet::mousePressEvent( QMouseEvent *)
{
ScreenshotControl *sc = new ScreenshotControl ( );
QPoint curPos = mapToGlobal ( QPoint ( 0, 0 ));
// windowPosX is the windows position centered above the applets icon.
// If the icon is near the edge of the screen, the window would leave the visible area
// so we check the position against the screen width and correct the difference if needed
int screenWidth = qApp->desktop()->width();
int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ;
int ZwindowPosX, XwindowPosX;
// the window would be placed beyond the screen wich doesn't look tooo good
if ( (windowPosX + sc-> sizeHint ( ). width ( )) > screenWidth ) {
XwindowPosX = windowPosX + sc-> sizeHint ( ). width ( ) - screenWidth;
ZwindowPosX = windowPosX - XwindowPosX - 1;
} else {
ZwindowPosX = windowPosX;
}
sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) );
sc-> show ( );
}
void ScreenshotApplet::paintEvent( QPaintEvent* )
{
QPainter p ( this );
p.drawPixmap( 0,0, m_icon );
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ScreenshotApplet> );
-}
+
+EXPORT_OPIE_APPLET_v1( ScreenshotApplet )
diff --git a/core/applets/suspendapplet/config.in b/core/applets/suspendapplet/config.in
index fdbe8b3..d75f581 100644
--- a/core/applets/suspendapplet/config.in
+++ b/core/applets/suspendapplet/config.in
@@ -1,4 +1,4 @@
config SUSPENDAPPLET
boolean "Suspend"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/vmemo/config.in b/core/applets/vmemo/config.in
index d13492d..356ab16 100644
--- a/core/applets/vmemo/config.in
+++ b/core/applets/vmemo/config.in
@@ -1,4 +1,4 @@
config VMEMO
boolean "opie-vmemo (take voice memos)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 27f6015..7dd5b4b 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -148,96 +148,97 @@ static char * vmemo_xpm[] = {
"H c #5A5A5F",
"I c #BBBBC3",
"J c #C4C4CB",
"K c #909098",
"L c #737379",
"M c #343437",
"N c #8F8F98",
"O c #000407",
"P c #2D3137",
"Q c #B0B1BC",
"R c #3B3C40",
"S c #6E6E74",
"T c #95959C",
"U c #74747A",
"V c #1D1D1E",
"W c #91929A",
"X c #42444A",
"Y c #22282E",
"Z c #B0B2BC",
"` c #898A90",
" . c #65656A",
".. c #999AA2",
"+. c #52535A",
"@. c #151B21",
"#. c #515257",
"$. c #B5B5BE",
"%. c #616167",
"&. c #1A1D22",
"*. c #000713",
"=. c #1F1F21",
" ",
" . + @ # ",
" $ % & * = - ",
" ; > , ' ) ! ~ ",
" { ] ^ / ( _ : ",
" < [ } | 1 2 3 ",
" 4 5 6 7 8 9 0 a b c ",
" d e f g h i j 3 k l m n ",
" o p q r s t u v w n ",
" o x y z A B C D E n ",
" F G H I J K L M N O ",
" P Q R S T U V W X ",
" Y Z ` b ...+. ",
" @.#.$.%.&. ",
" *.B =. ",
" n n n n n n n n n "};
+using namespace Opie::Ui;
VMemo::VMemo( QWidget *parent, const char *_name )
: QWidget( parent, _name ) {
setFixedHeight( 18 );
setFixedWidth( 14 );
t_timer = new QTimer( this );
connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) );
Config vmCfg("Vmemo");
vmCfg.setGroup("Defaults");
int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1));
useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0);
qDebug("toggleKey %d", toggleKey);
if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
systemZaurus=TRUE;
else
systemZaurus=FALSE;
myChannel = new QCopChannel( "QPE/VMemo", this );
connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(receive(const QCString&,const QByteArray&)) );
if( toggleKey != -1 ) {
// keyRegister(key, channel, message)
QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)");
// e << 4096; // Key_Escape
// e << Key_F5; //4148
e << toggleKey;
e << QString("QPE/VMemo");
e << QString("toggleRecord()");
}
if(toggleKey == 1)
usingIcon=TRUE;
else
usingIcon=FALSE;
if( vmCfg.readNumEntry("hideIcon",0) == 1)
hide();
recording = FALSE;
// }
}
VMemo::~VMemo() {
}
int VMemo::position()
{
return 6;
@@ -593,53 +594,51 @@ bool VMemo::record() {
QString foo = cfg.readEntry("Mute","TRUE");
if(foo.find("TRUE",0,TRUE) != -1)
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute
return TRUE;
}
int VMemo::setToggleButton(int tog) {
for( int i=0; i < 10;i++) {
switch (tog) {
case 0:
return -1;
break;
case 1:
return 0;
break;
case 2:
return Key_F24; //was Escape
break;
case 3:
return Key_Space;
break;
case 4:
return Key_F12;
break;
case 5:
return Key_F9;
break;
case 6:
return Key_F10;
break;
case 7:
return Key_F11;
break;
case 8:
return Key_F13;
break;
};
}
return -1;
}
void VMemo::timerBreak() {
//stop
stopRecording();
QMessageBox::message("Vmemo","Vmemo recording has ended");
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VMemo> );
-}
+
+EXPORT_OPIE_APPLET_v1( VMemo )
diff --git a/core/applets/volumeapplet/config.in b/core/applets/volumeapplet/config.in
index 1233d9f..f097591 100644
--- a/core/applets/volumeapplet/config.in
+++ b/core/applets/volumeapplet/config.in
@@ -1,4 +1,4 @@
config VOLUMEAPPLET
boolean "opie-volumeapplet (set volume for microphone and speaker)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index 942cebb..276f47f 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -1,97 +1,98 @@
/**********************************************************************
** 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 "volume.h"
#include "oledbox.h"
#include <opie2/odevice.h>
#include <opie2/otaskbarapplet.h>
#include <qpe/resource.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpainter.h>
#include <qcheckbox.h>
#include <qslider.h>
#include <qlayout.h>
#include <qvbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qtimer.h>
#include <stdio.h>
-using namespace Opie;
+using namespace Opie::Core;
#define RATE_TIMER_INTERVAL 100
// Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time
// results in "hanging" buttons on the iPAQ due to quite high CPU consumption.
/* XPM */
+using namespace Opie::Ui;
static const char * vol_xpm[] = {
"20 20 3 1",
" c None",
". c #0000FF",
"+ c #000000",
" ",
" . ",
" . . . . ",
" . . . . . . ",
" . . . . . . . ",
" . . ..... . . ",
" . ... ..... ... ",
" ........... .... ",
" ................. ",
"++++++++++++++++++++",
" .................. ",
" . ............. . ",
" . ..... ....... ",
" . ... ..... . ",
" . ... ..... . ",
" . ... ..... ",
" . . . . . ",
" . . . ",
" . . . ",
" "};
/* XPM */
static const char * mic_xpm[] = {
"20 20 21 1",
" c None",
". c #000000",
"+ c #EEEEEE",
"@ c #B4B6B4",
"# c #8B8D8B",
"$ c #D5D6D5",
"% c #E6E6E6",
"& c #9C9D9C",
"* c #6A696A",
"= c #E6E2E6",
"- c #F6F2F6",
"; c #CDC6CD",
"> c #737573",
", c #4A484A",
"' c #DEDEDE",
") c #F6EEF6",
"! c #414041",
"~ c #202020",
"{ c #ACAEAC",
"] c #838583",
@@ -732,52 +733,49 @@ VolumeApplet::~VolumeApplet()
{
delete m_pixmap;
}
int VolumeApplet::position()
{
return 6;
}
void VolumeApplet::mousePressEvent ( QMouseEvent * )
{
if ( m_dialog-> isVisible ( ))
m_dialog-> hide ( );
else
m_dialog-> show ( true );
}
void VolumeApplet::redraw ( bool all )
{
if ( all )
repaint ( true );
else
repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false );
}
void VolumeApplet::paintEvent ( QPaintEvent * )
{
QPainter p ( this );
p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap );
p. setPen ( darkGray );
p. drawRect ( 1, height() - 4, width() - 2, 4 );
int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100;
p. fillRect ( 2, height() - 3, pixelsWide, 2, red );
p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray );
if ( m_dialog-> volMuted ( )) {
p. setPen ( red );
p. drawLine ( 1, 2, width() - 2, height() - 5 );
p. drawLine ( 1, 3, width() - 2, height() - 4 );
p. drawLine ( width() - 2, 2, 1, height() - 5 );
p. drawLine ( width() - 2, 3, 1, height() - 4 );
}
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VolumeApplet> );
-}
+EXPORT_OPIE_APPLET_v1( VolumeApplet )
diff --git a/core/applets/volumeapplet/volumeapplet.pro b/core/applets/volumeapplet/volumeapplet.pro
index b14956e..b478ed1 100644
--- a/core/applets/volumeapplet/volumeapplet.pro
+++ b/core/applets/volumeapplet/volumeapplet.pro
@@ -1,13 +1,13 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on release
HEADERS = volume.h oledbox.h
SOURCES = volume.cpp oledbox.cpp
TARGET = volumeapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += ../$(OPIEDIR)/include
-LIBS += -lqpe
+LIBS += -lqpe -lopiecore2
VERSION = 1.0.0
include ( $(OPIEDIR)/include.pro )
target.path = $$prefix/plugins/applets
diff --git a/core/applets/vtapplet/config.in b/core/applets/vtapplet/config.in
index 85692a5..8fe4200 100644
--- a/core/applets/vtapplet/config.in
+++ b/core/applets/vtapplet/config.in
@@ -1,4 +1,4 @@
config VTAPPLET
boolean "VT (switch to another virtual terminal)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/obex/config.in b/core/obex/config.in
index ef09f7a..c0208d1 100644
--- a/core/obex/config.in
+++ b/core/obex/config.in
@@ -1,4 +1,4 @@
config OBEX
boolean "libopieobex0 (library needed for beaming in Opie)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 50e5201..3c99af6 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -1,134 +1,135 @@
#include <qfileinfo.h>
-#include <opie/oprocess.h>
+#include <opie2/oprocess.h>
#include "obex.h"
using namespace OpieObex;
+using namespace Opie::Core;
/* TRANSLATOR OpieObex::Obex */
Obex::Obex( QObject *parent, const char* name )
: QObject(parent, name )
{
m_rec = 0;
m_send=0;
m_count = 0;
m_receive = false;
connect( this, SIGNAL(error(int) ), // for recovering to receive
SLOT(slotError() ) );
connect( this, SIGNAL(sent(bool) ),
SLOT(slotError() ) );
};
Obex::~Obex() {
delete m_rec;
delete m_send;
}
void Obex::receive() {
m_receive = true;
m_outp = QString::null;
qWarning("Receive" );
m_rec = new OProcess();
*m_rec << "irobex_palm3";
// connect to the necessary slots
- connect(m_rec, SIGNAL(processExited(OProcess*) ),
- this, SLOT(slotExited(OProcess*) ) );
+ connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ),
+ this, SLOT(slotExited(Opie::Core::OProcess*) ) );
- connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
- this, SLOT(slotStdOut(OProcess*, char*, int) ) );
+ connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
+ this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
qWarning("could not start :(");
emit done( false );
delete m_rec;
m_rec = 0;
}
// emit currentTry(m_count );
}
void Obex::send( const QString& fileName) { // if currently receiving stop it send receive
m_count = 0;
m_file = fileName;
qWarning("send %s", fileName.latin1() );
if (m_rec != 0 ) {
qWarning("running");
if (m_rec->isRunning() ) {
emit error(-1 );
qWarning("is running");
delete m_rec;
m_rec = 0;
}else{
qWarning("is not running");
emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
return;
}
}
sendNow();
}
void Obex::sendNow(){
qWarning("sendNow");
if ( m_count >= 25 ) { // could not send
emit error(-1 );
emit sent(false);
return;
}
// OProcess inititialisation
m_send = new OProcess();
*m_send << "irobex_palm3";
*m_send << QFile::encodeName(m_file);
// connect to slots Exited and and StdOut
- connect(m_send, SIGNAL(processExited(OProcess*) ),
- this, SLOT(slotExited(OProcess*)) );
- connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )),
- this, SLOT(slotStdOut(OProcess*, char*, int) ) );
+ connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ),
+ this, SLOT(slotExited(Opie::Core::OProcess*)) );
+ connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )),
+ this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
// now start it
if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
qWarning("could not send" );
m_count = 25;
emit error(-1 );
delete m_send;
m_send=0;
}
// end
m_count++;
emit currentTry( m_count );
}
void Obex::slotExited(OProcess* proc ){
if (proc == m_rec ) { // receive process
received();
}else if ( proc == m_send ) {
sendEnd();
}
}
void Obex::slotStdOut(OProcess* proc, char* buf, int len){
if ( proc == m_rec ) { // only receive
QByteArray ar( len );
memcpy( ar.data(), buf, len );
qWarning("parsed: %s", ar.data() );
m_outp.append( ar );
}
}
void Obex::received() {
if (m_rec->normalExit() ) {
if ( m_rec->exitStatus() == 0 ) { // we got one
QString filename = parseOut();
qWarning("ACHTUNG %s", filename.latin1() );
emit receivedFile( filename );
}
}else{
emit done(false);
};
delete m_rec;
m_rec = 0;
receive();
}
void Obex::sendEnd() {
if (m_send->normalExit() ) {
if ( m_send->exitStatus() == 0 ) {
diff --git a/core/obex/obex.h b/core/obex/obex.h
index 60f5d28..284cb12 100644
--- a/core/obex/obex.h
+++ b/core/obex/obex.h
@@ -1,84 +1,84 @@
#ifndef OpieObex_H
#define OpieObex_H
#include <qobject.h>
-class OProcess;
+namespace Opie {namespace Core {class OProcess;}}
class QCopChannel;
namespace OpieObex {
class Obex : public QObject {
Q_OBJECT
public:
/**
* Obex c'tor look
*/
Obex( QObject *parent, const char* name);
/**
* d'tor
*/
~Obex();
/**
* Starting listening to irda after enabled by the applet
* a signal gets emitted when recieved a file
*/
void receive();
void send( const QString& );
void setReceiveEnabled( bool = false );
signals:
/**
* a signal
* @param path The path to the recieved file
*/
void receivedFile( const QString& path);
/**
* error signal if the program couldn't be started or the
* the connection timed out
*/
void error( int );
/**
* The current try to receive data
*/
void currentTry(unsigned int);
/**
* signal sent The file got beamed to the remote location
*/
void sent(bool);
void done(bool);
private:
uint m_count;
QString m_file;
QString m_outp;
- OProcess *m_send;
- OProcess *m_rec;
+ Opie::Core::OProcess *m_send;
+ Opie::Core::OProcess *m_rec;
bool m_receive : 1;
void shutDownReceive();
private slots:
/**
* send over palm obex
*/
//void send(const QString&);
// the process exited
- void slotExited(OProcess* proc) ;
- void slotStdOut(OProcess*, char*, int);
+ void slotExited(Opie::Core::OProcess* proc) ;
+ void slotStdOut(Opie::Core::OProcess*, char*, int);
void slotError();
private:
void sendNow();
QString parseOut();
void received();
void sendEnd();
};
};
#endif
diff --git a/core/obex/obex.pro b/core/obex/obex.pro
index a296b2c..51fa300 100644
--- a/core/obex/obex.pro
+++ b/core/obex/obex.pro
@@ -1,13 +1,13 @@
TEMPLATE = lib
CONFIG += qt warn_on release
-HEADERS = obex.h obexhandler.h obexsend.h receiver.h
-SOURCES = obex.cc obexsend.cpp obexhandler.cpp receiver.cpp
+HEADERS = obex.h obexhandler.h obexsend.h receiver.h obeximpl.h
+SOURCES = obex.cc obexsend.cpp obexhandler.cpp receiver.cpp obeximpl.cpp
TARGET = opieobex
DESTDIR = $(OPIEDIR)/plugins/obex
INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher
DEPENDPATH += ../$(OPIEDIR)/include
LIBS += -lqpe -lopiecore2
VERSION = 0.0.2
include ( $(OPIEDIR)/include.pro )
target.path = $$prefix/plugins/applets
diff --git a/core/obex/obeximpl.cpp b/core/obex/obeximpl.cpp
index 5b53644..ca6ce7b 100644
--- a/core/obex/obeximpl.cpp
+++ b/core/obex/obeximpl.cpp
@@ -1,32 +1,34 @@
#include "obexhandler.h"
#include "obeximpl.h"
+
+
using namespace OpieObex;
/* TRANSLATOR OpieObex::ObexImpl */
ObexImpl::ObexImpl() {
m_handler = new ObexHandler;
}
ObexImpl::~ObexImpl() {
delete m_handler;
}
QRESULT ObexImpl::queryInterface( const QUuid& uuid, QUnknownInterface **iface ) {
*iface = 0;
if ( uuid == IID_QUnknown ) {
*iface = this;
}else if ( uuid == IID_ObexInterface )
*iface = this;
else
return QS_FALSE;
if (*iface)
(*iface)->addRef();
return QS_OK;
}
Q_EXPORT_INTERFACE() {
Q_CREATE_INSTANCE( ObexImpl )
}