summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp10
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp2
-rw-r--r--core/applets/cardmon/cardmon.cpp4
-rw-r--r--core/applets/homeapplet/home.h0
-rw-r--r--core/applets/restartapplet2/.cvsignore1
-rw-r--r--core/applets/suspendapplet/suspend.h0
-rw-r--r--core/launcher/launcher.cpp158
-rw-r--r--core/obex/obex.cc13
-rw-r--r--core/obex/obexhandler.cpp2
-rw-r--r--core/obex/obeximpl.cpp2
-rw-r--r--core/obex/obexsend.cpp2
-rw-r--r--core/obex/receiver.cpp73
-rw-r--r--core/obex/receiver.h5
13 files changed, 130 insertions, 142 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index 480d261..078ce8d 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -122,18 +122,8 @@ void BatteryMeter::paintEvent( QPaintEvent* )
QFont f( "Fixed", AppLnk::smallIconSize()/2 );
QFontMetrics fm( f );
p.setFont( f );
- if ( percent > 98 ) {
- p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "F" ) );
- }
- else if ( percent < 5 )
- {
- p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "E" ) );
- }
- else
- {
p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) );
p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" );
- }
return;
}
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
index 092a48d..5936b5d 100644
--- a/core/applets/batteryapplet/batterystatus.cpp
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -240,7 +240,7 @@ void BatteryStatus::paintEvent( QPaintEvent * ) {
jacketMsg = tr("No jacket with battery inserted");
}
- int jackPerc = ( jackPercent / 100.0 ) * screenWidth - 47;
+ int jackPerc = ( jackPercent / 100.0 ) * ( screenWidth - 47 ) ;
qDrawShadePanel( &p, 9, 160, rightEnd1, 39, colorGroup(), TRUE, 1, NULL);
qDrawShadePanel( &p, rightEnd2, 167, 12, 24, colorGroup(), TRUE, 1, NULL);
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index b8c4553..4ed09b8 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -272,7 +272,9 @@ bool CardMonitor::getStatusPcmcia(int showPopUp)
text += cardInPcmcia1Name;
popUp(text, "cardmon/" + cardInPcmcia1Type);
}
+#ifndef QT_NO_SOUND
QSound::play(Resource::findSound("cardmon/card" + what));
+#endif
}
} else {
// no file found
@@ -324,7 +326,9 @@ bool CardMonitor::getStatusSd(int showPopUp)
what = "off";
}
//qDebug("TEXT: " + text );
+#ifndef QT_NO_SOUND
QSound::play(Resource::findSound("cardmon/card" + what));
+#endif
popUp(text, "cardmon/ide"); // XX add SD pic
}
#else
diff --git a/core/applets/homeapplet/home.h b/core/applets/homeapplet/home.h
index 64af97d..1186caf 100644
--- a/core/applets/homeapplet/home.h
+++ b/core/applets/homeapplet/home.h
diff --git a/core/applets/restartapplet2/.cvsignore b/core/applets/restartapplet2/.cvsignore
index a403d26..4943911 100644
--- a/core/applets/restartapplet2/.cvsignore
+++ b/core/applets/restartapplet2/.cvsignore
@@ -4,4 +4,3 @@ Makefile*
config.in
moc_*
opieobjconfig.in
-opieobj
diff --git a/core/applets/suspendapplet/suspend.h b/core/applets/suspendapplet/suspend.h
index 0c92bcb..75467c1 100644
--- a/core/applets/suspendapplet/suspend.h
+++ b/core/applets/suspendapplet/suspend.h
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 0205622..8b2907a 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -22,8 +22,6 @@
// have this class.
#define QTOPIA_INTERNAL_FSLP
-//#include <opie/ofiledialog.h>
-#include <opie/ofileselector.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
#include <qpe/applnk.h>
@@ -165,41 +163,41 @@ void CategoryTabWidget::showTab(const QString& id)
void CategoryTabWidget::addItem( const QString& linkfile )
{
-// int i=0;
-// AppLnk *app = new AppLnk(linkfile);
-// if ( !app->isValid() ) {
-// delete app;
-// app=0;
-// }
-// if ( !app || !app->file().isEmpty() ) {
+ int i=0;
+ AppLnk *app = new AppLnk(linkfile);
+ if ( !app->isValid() ) {
+ delete app;
+ app=0;
+ }
+ if ( !app || !app->file().isEmpty() ) {
// A document
-// delete app;
-// app = new DocLnk(linkfile);
-// if ( app->fileKnown() ) {
-// ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
-// } else {
-// ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
-// delete app;
-// }
-// return;
-// }
+ delete app;
+ app = new DocLnk(linkfile);
+ if ( app->fileKnown() ) {
+ ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
+ } else {
+ ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
+ delete app;
+ }
+ return;
+ }
// An application
-// for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
-// if ( !(*it).isEmpty() ) {
-// QRegExp tf(*it,FALSE,TRUE);
-// if ( tf.match(app->type()) >= 0 ) {
-// ((LauncherView*)stack->widget(i))->addItem(app);
-// return;
-// }
-// i++;
- // }
- // }
+ for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
+ if ( !(*it).isEmpty() ) {
+ QRegExp tf(*it,FALSE,TRUE);
+ if ( tf.match(app->type()) >= 0 ) {
+ ((LauncherView*)stack->widget(i))->addItem(app);
+ return;
+ }
+ i++;
+ }
+ }
QCopEnvelope e("QPE/TaskBar","reloadApps()");
}
void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
- AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/)
+ AppLnkSet* docFolder, const QList<FileSystem> &fs)
{
QString current;
if ( categoryBar ) {
@@ -253,23 +251,13 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
QImage img( Resource::loadImage( "DocsIcon" ) );
QPixmap pm;
pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
-
- //ljpotter
- CategoryTab *catTab ;
- catTab = new CategoryTab( pm, "Documents" );
-
- categoryBar->addTab( catTab );
-
- fileSel = new DocumentTab( stack, 4, 0, "/","");
- stack->addWidget( fileSel, tabs++ );
-
- // fileSel->hide();
-
- connect( fileSel, SIGNAL( fileSelected( const DocLnk & )),
- this, SLOT(clickie(const DocLnk&)) );
-
-// connect( fileSel, SIGNAL( fileSelected( const QString & )),
-// this, SLOT(clickie(const QString&)) );
+ docview = newView( "Documents", // No tr
+ pm, tr("Documents"));
+ docview->populate( docFolder, QString::null );
+ docFolder->detachChildren();
+ docview->setFileSystems(fs);
+ docview->setToolsEnabled(TRUE);
+ setTabAppearance( "Documents", cfg ); // No tr
connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
@@ -285,20 +273,9 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
categoryBar->show();
stack->show();
-
QCopEnvelope e("QPE/TaskBar","reloadApps()");
}
-void CategoryTabWidget::clickie(const DocLnk &lnk) {
- lnk.execute();
- // fileSel->reparse();
-}
-
-void CategoryTabWidget::clickie(const QString &appStr) {
-// DocLnk lnk(appStr);
-// lnk.execute();
-}
-
void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
{
QString grp( "Tab %1" ); // No tr
@@ -341,10 +318,13 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
tab->fgColor = QColor(tabTextCol);
}
-//void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/)
-//{
- // docFolder->detachChildren();
-//}
+void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs)
+{
+ docview->populate( docFolder, QString::null );
+ docFolder->detachChildren();
+ docview->setFileSystems(fs);
+ docview->updateTools();
+}
void CategoryTabWidget::tabProperties()
{
@@ -363,7 +343,7 @@ void CategoryTabWidget::tabProperties()
QString CategoryTabWidget::getAllDocLinkInfo() const
{
- return "";
+ return docview->getAllDocLinkInfo();
}
LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
@@ -381,14 +361,15 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm,
void CategoryTabWidget::updateLink(const QString& linkfile)
{
- // LauncherView* view;
- qApp->processEvents();
-// while ((view = (LauncherView*)stack->widget(i++))) {
-// if ( view->removeLink(linkfile) )
-// break;
-// }
- // addItem(linkfile);
- fileSel->reparse();
+ int i=0;
+ LauncherView* view;
+ //qApp->processEvents();
+ while ((view = (LauncherView*)stack->widget(i++))) {
+ if ( view->removeLink(linkfile) )
+ break;
+ }
+ addItem(linkfile);
+ docview->updateTools();
}
void CategoryTabWidget::paletteChange( const QPalette &p )
@@ -406,7 +387,7 @@ void CategoryTabWidget::setBusy(bool on)
if ( on )
((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
else
- for (int i=0; i<tabs-1; i++)
+ for (int i=0; i<tabs; i++)
((LauncherView*)stack->widget(i))->setBusy(FALSE);
}
@@ -667,7 +648,6 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
connect( tabs, SIGNAL(rightPressed(AppLnk*)),
this, SLOT(properties(AppLnk*)));
-
#if !defined(QT_NO_COP)
QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
@@ -752,13 +732,16 @@ void Launcher::updateMimeTypes(AppLnkSet* folder)
*/
void Launcher::loadDocs() // ok here comes a hack belonging to Global::
{
+
OWait *owait = new OWait();
Global::statusMessage( tr( "Finding documents" ) );
owait->show();
qApp->processEvents();
- if(docsFolder) delete docsFolder;
+
+ delete docsFolder;
docsFolder = new DocLnkSet;
+
DocLnkSet *tmp = 0;
QString home = QString(getenv("HOME")) + "/Documents";
tmp = new DocLnkSet( home , QString::null);
@@ -781,11 +764,9 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
Config mediumCfg( "medium");
mediumCfg.setGroup("main");
// a) -zecke we don't want to check
- if(!mediumCfg.readBoolEntry("use", true ) ) {
- owait->hide();
- delete owait;
+ if(!mediumCfg.readBoolEntry("use", true ) )
return;
- }
+
// find out wich filesystems are new in this round
// We will do this by having a timestamp inside each mountpoint
// if the current timestamp doesn't match this is a new file system and
@@ -804,8 +785,6 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
delete tmp;
}
} // done
- owait->hide();
- delete owait;
return; // save the else
}
// c) zecke
@@ -869,6 +848,7 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
void Launcher::updateTabs()
{
MimeType::updateApplications(); // ### reads all applnks twice
+
delete rootFolder;
rootFolder = new AppLnkSet( MimeType::appsFolderName() );
@@ -880,7 +860,7 @@ void Launcher::updateTabs()
void Launcher::updateDocs()
{
loadDocs();
- // tabs->updateDocs(docsFolder,storage->fileSystems());
+ tabs->updateDocs(docsFolder,storage->fileSystems());
}
void Launcher::viewSelected(const QString& s)
@@ -1337,19 +1317,3 @@ void Launcher::preloadApps()
#endif
}
}
-
-DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName)
- : OFileSelector(parent,mode,selector,dirName,fileName)
-{
- setYesCancelVisible(false);
- setToolbarVisible(false);
- setPermissionBarVisible(false);
- setLineEditVisible(false) ;
- //setChooserVisible( bool chooser );
-
-}
-
-DocumentTab::~DocumentTab() {
-
-}
-
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 595fed9..2a306de 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -11,6 +11,8 @@
using namespace OpieObex;
+/* TRANSLATOR OpieObex::Obex */
+
Obex::Obex( QObject *parent, const char* name )
: QObject(parent, name )
{
@@ -109,10 +111,6 @@ void Obex::slotExited(OProcess* proc ){
}
void Obex::slotStdOut(OProcess* proc, char* buf, int len){
if ( proc == m_rec ) { // only receive
- for (int i = 0; i < len; i++ ) {
- printf("%c", buf[i] );
- }
- printf("\n");
QByteArray ar( len );
memcpy( ar.data(), buf, len );
qWarning("parsed: %s", ar.data() );
@@ -125,13 +123,6 @@ void Obex::received() {
if ( m_rec->exitStatus() == 0 ) { // we got one
QString filename = parseOut();
qWarning("ACHTUNG %s", filename.latin1() );
- if (filename.contains( 'ö' ) || filename.contains( 'ä' ) || filename.contains('ü' ) ) {
- qWarning("renaming!!!!");
- QFileInfo inf( filename );
- QString newName = "/tmp/opie-obex." + inf.extension();
- ::rename( QFile::encodeName( filename ).data(), newName );
- qWarning("name is %s", QFile::encodeName( filename ).data() );
- }
emit receivedFile( filename );
}
}else{
diff --git a/core/obex/obexhandler.cpp b/core/obex/obexhandler.cpp
index 6509d12..5aaf63c 100644
--- a/core/obex/obexhandler.cpp
+++ b/core/obex/obexhandler.cpp
@@ -8,6 +8,8 @@
using namespace OpieObex;
+/* TRANSLATOR OpieObex::ObexHandler */
+
ObexHandler::ObexHandler() {
m_wasRec = false;
m_sender = 0l;
diff --git a/core/obex/obeximpl.cpp b/core/obex/obeximpl.cpp
index 12a078f..5bfc779 100644
--- a/core/obex/obeximpl.cpp
+++ b/core/obex/obeximpl.cpp
@@ -3,6 +3,8 @@
using namespace OpieObex;
+/* TRANSLATOR OpieObex::ObexImpl */
+
ObexImpl::ObexImpl() {
m_handler = new ObexHandler;
}
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 2931cf7..cf5d958 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -15,6 +15,8 @@
using namespace OpieObex;
+/* TRANSLATOR OpieObex::SendWidget */
+
SendWidget::SendWidget( QWidget* parent, const char* name )
: QWidget( parent, name ) {
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp
index 31c6afe..bf9e30c 100644
--- a/core/obex/receiver.cpp
+++ b/core/obex/receiver.cpp
@@ -1,6 +1,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <stdlib.h> // int system
#include <unistd.h>
#include <fcntl.h>
@@ -9,18 +10,22 @@
#include <qfileinfo.h>
#include <qlabel.h>
#include <qhbox.h>
+#include <qregexp.h>
#include <qtextview.h>
#include <qpushbutton.h>
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
+#include <qpe/global.h>
#include "obex.h"
#include "receiver.h"
using namespace OpieObex;
+/* TRANSLATOR OpieObex::Receiver */
+
Receiver::Receiver() {
m_obex = new Obex(this, "Receiver");
connect(m_obex, SIGNAL(receivedFile(const QString& ) ),
@@ -31,7 +36,8 @@ Receiver::~Receiver() {
m_obex->setReceiveEnabled( false );
delete m_obex;
}
-void Receiver::slotReceived( const QString& file ) {
+void Receiver::slotReceived( const QString& _file ) {
+ QString file = _file;
int check = checkFile(file);
if ( check == AddressBook )
handleAddr( file );
@@ -59,21 +65,58 @@ void Receiver::handleOther( const QString& other ) {
OtherHandler* hand = new OtherHandler();
hand->handle( other );
}
-int Receiver::checkFile( const QString& file ) {
+void Receiver::tidyUp( QString& _file, const QString& ending) {
+ /* libversit fails on BASE64 encoding we try to sed it away */
+ QString file = _file;
+ char foo[24]; // big enough
+ (void)::strcpy(foo, "/tmp/opie-XXXXXX");
+
+ int fd = ::mkstemp(foo);
+
+ if ( fd == -1 )
+ return;
+
+ (void)::strncat( foo, ending.latin1(), 4 );
+ _file = QString::fromLatin1( foo );
+ QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) );
+ qWarning("Executing: %s", cmd.latin1() );
+ (void)::system( cmd.latin1() );
+
+ cmd = QString("rm %1").arg( Global::shellQuote(file) );
+ (void)::system( cmd.latin1() );
+}
+int Receiver::checkFile( QString& file ) {
qWarning("check file!! %s", file.latin1() );
int ret;
+ QString ending;
+
if (file.right(4) == ".vcs" ) {
ret = Datebook;
+ ending = QString::fromLatin1(".vcs");
}else if ( file.right(4) == ".vcf") {
ret = AddressBook;
+ ending = QString::fromLatin1(".vcf");
}else
ret = Other;
+ if (ending.isEmpty() )
+ return ret;
+
+ /**
+ * currently the parser is broken in regard of BASE64 encoding
+ * and M$ likes to send that. So we will executed a small
+ * tidy up system sed script
+ * At this point we can also remove umlaute from the filename
+ */
+ tidyUp( file, ending );
+
qWarning("check it now %d", ret );
return ret;
}
+/* TRANSLATOR OpieObex::OtherHandler */
+
OtherHandler::OtherHandler()
: QVBox()
{
@@ -133,6 +176,10 @@ void OtherHandler::deny() {
}
QString OtherHandler::targetName( const QString& file ) {
QFileInfo info( file );
+
+ /* $HOME needs to be set!!!! */
+ Global::createDocDir();
+
QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName();
QString newFileBase = newFile;
@@ -149,24 +196,8 @@ QString OtherHandler::targetName( const QString& file ) {
/* fast cpy */
void OtherHandler::copy(const QString& src, const QString& file) {
qWarning("src %s, dest %s", src.latin1(),file.latin1() );
- int src_fd = ::open( QFile::encodeName( src ), O_RDONLY );
- int to_fd = ::open( QFile::encodeName( file), O_RDWR| O_CREAT| O_TRUNC,
- S_IRUSR, S_IWUSR, S_IRGRP, S_IRGRP );
-
- struct stat stater;
- ::fstat(src_fd, &stater );
- ::lseek(to_fd, stater.st_size-1, SEEK_SET );
- ::write(to_fd, "", 1 );
-
- void *src_addr, *dest_addr;
- src_addr = ::mmap(0, stater.st_size, PROT_READ,
- MAP_FILE | MAP_SHARED, src_fd, 0 );
- dest_addr= ::mmap(0, stater.st_size, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_PRIVATE, to_fd, 0 );
-
- ::memcpy(dest_addr , src_addr, stater.st_size );
- ::munmap(src_addr , stater.st_size );
- ::munmap(dest_addr, stater.st_size );
-
+ QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )).
+ arg( Global::shellQuote( file ) );
+ ::system( cmd.latin1() );
// done
}
diff --git a/core/obex/receiver.h b/core/obex/receiver.h
index 5b20146..e1d54df 100644
--- a/core/obex/receiver.h
+++ b/core/obex/receiver.h
@@ -21,9 +21,12 @@ namespace OpieObex {
void handleAddr(const QString& );
void handleDateTodo(const QString& );
void handleOther(const QString& );
- int checkFile( const QString& file );
+ /* will alter the file name */
+ int checkFile( QString& file );
bool testDateTodo(const QString& file);
bool testAddressbook(const QString& file);
+ /* called by checkFile */
+ void tidyUp( QString& file, const QString& ending );
private slots:
void slotReceived( const QString& );