summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp14
-rw-r--r--core/applets/clipboardapplet/clipboardapplet.pro2
-rw-r--r--core/applets/clipboardapplet/opie-clipboardapplet.control2
-rw-r--r--core/applets/logoutapplet/logout.cpp9
-rw-r--r--core/applets/logoutapplet/logoutapplet.pro2
5 files changed, 12 insertions, 17 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 57a4088..a32e98b 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -1,149 +1,147 @@
/**********************************************************************
** 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 <opie2/oresource.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_clipboardPixmap = Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon );
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 );
if ( m_history. count ( )) {
for ( unsigned int i = 0; i < m_history. count ( ); i++ ) {
QString str = m_history [i];
if ( str. length ( ) > 20 )
str = str. left ( 20 ) + "...";
m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i );
m_menu-> setItemChecked ( i, false );
}
m_menu-> setItemChecked ( m_history. count ( ) - 1, true );
m_menu-> insertSeparator ( );
}
- m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 );
- m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 );
- m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 );
+ m_menu-> insertItem ( Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ), tr( "Cut" ), 100 );
+ m_menu-> insertItem ( Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ), tr( "Copy" ), 101 );
+ m_menu-> insertItem ( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), tr( "Paste" ), 102 );
connect ( m_menu, SIGNAL( activated(int)), this, SLOT( action(int)));
m_dirty = false;
}
QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
QSize s = m_menu-> sizeHint ( );
m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )));
}
void ClipboardApplet::action(int id)
{
ushort unicode = 0;
int scan = 0;
switch ( id ) {
case 100:
unicode = 'X' - '@';
scan = Key_X; // Cut
break;
case 101:
unicode = 'C' - '@';
scan = Key_C; // Copy
break;
case 102:
unicode = 'V' - '@';
scan = Key_V; // Paste
break;
default:
if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) {
QApplication::clipboard ( )-> setText ( m_history [id] );
for ( uint i = 0; i < m_history. count ( ); i++ )
m_menu-> setItemChecked ( i, i == uint( id ));
unicode = 'V' - '@';
scan = Key_V;
}
break;
}
if ( scan ) {
qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false );
qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false );
}
}
diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro
index 647598d..cdd0121 100644
--- a/core/applets/clipboardapplet/clipboardapplet.pro
+++ b/core/applets/clipboardapplet/clipboardapplet.pro
@@ -1,13 +1,13 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on
HEADERS = clipboard.h
SOURCES = clipboard.cpp
TARGET = clipboardapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH +=
-LIBS += -lqpe
+LIBS += -lqpe -lopiecore2
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
target.path = $$prefix/plugins/applets
diff --git a/core/applets/clipboardapplet/opie-clipboardapplet.control b/core/applets/clipboardapplet/opie-clipboardapplet.control
index e0e2d82..6596633 100644
--- a/core/applets/clipboardapplet/opie-clipboardapplet.control
+++ b/core/applets/clipboardapplet/opie-clipboardapplet.control
@@ -1,10 +1,10 @@
Package: opie-clipboardapplet
Files: plugins/applets/libclipboardapplet.so*
Priority: optional
Section: opie/applets
Maintainer: Robert Griebl <sandman@handhelds.org>
Architecture: arm
-Depends: task-opie-minimal
+Depends: task-opie-minimal, libopiecore2
Description: Clipboard applet
Clipboard applet for the Opie environment taskbar.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/core/applets/logoutapplet/logout.cpp b/core/applets/logoutapplet/logout.cpp
index 0f36f16..dc0c67c 100644
--- a/core/applets/logoutapplet/logout.cpp
+++ b/core/applets/logoutapplet/logout.cpp
@@ -1,100 +1,97 @@
#include "logout.h"
+#include <opie2/oresource.h>
+
#include <qpe/applnk.h>
-#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qapplication.h>
#include <qmessagebox.h>
#include <unistd.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( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
+ QPixmap pix = Opie::Core::OResource::loadPixmap("logout", Opie::Core::OResource::SmallIcon );
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/logoutapplet/logoutapplet.pro b/core/applets/logoutapplet/logoutapplet.pro
index 23cab02..5bb1571 100644
--- a/core/applets/logoutapplet/logoutapplet.pro
+++ b/core/applets/logoutapplet/logoutapplet.pro
@@ -1,13 +1,13 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on
HEADERS = logout.h
SOURCES = logout.cpp
TARGET = logoutapplet
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