author | kergoth <kergoth> | 2003-08-09 17:29:36 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:29:36 (UTC) |
commit | a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93 (patch) (side-by-side diff) | |
tree | 5ce78e1a5dedd31b7851d53bf9f072bd44edd1b0 /core | |
parent | a7e015198a8c5ad3b6e144a9032b059086253e00 (diff) | |
download | opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.zip opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.gz opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.bz2 |
Merge from BRANCH_1_0
-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 10 | ||||
-rw-r--r-- | core/applets/batteryapplet/batterystatus.cpp | 2 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 4 | ||||
-rw-r--r-- | core/applets/homeapplet/home.h | 0 | ||||
-rw-r--r-- | core/applets/restartapplet2/.cvsignore | 1 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.h | 0 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 158 | ||||
-rw-r--r-- | core/obex/obex.cc | 13 | ||||
-rw-r--r-- | core/obex/obexhandler.cpp | 2 | ||||
-rw-r--r-- | core/obex/obeximpl.cpp | 2 | ||||
-rw-r--r-- | core/obex/obexsend.cpp | 2 | ||||
-rw-r--r-- | core/obex/receiver.cpp | 73 | ||||
-rw-r--r-- | core/obex/receiver.h | 5 |
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 @@ -123,16 +123,6 @@ void BatteryMeter::paintEvent( QPaintEvent* ) 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 @@ -241,5 +241,5 @@ void BatteryStatus::paintEvent( QPaintEvent * ) { } - int jackPerc = ( jackPercent / 100.0 ) * screenWidth - 47; + int jackPerc = ( jackPercent / 100.0 ) * ( screenWidth - 47 ) ; qDrawShadePanel( &p, 9, 160, rightEnd1, 39, 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 @@ -273,5 +273,7 @@ bool CardMonitor::getStatusPcmcia(int showPopUp) popUp(text, "cardmon/" + cardInPcmcia1Type); } +#ifndef QT_NO_SOUND QSound::play(Resource::findSound("cardmon/card" + what)); +#endif } } else { @@ -325,5 +327,7 @@ bool CardMonitor::getStatusSd(int showPopUp) } //qDebug("TEXT: " + text ); +#ifndef QT_NO_SOUND QSound::play(Resource::findSound("cardmon/card" + what)); +#endif popUp(text, "cardmon/ide"); // XX add SD pic } 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 @@ -5,3 +5,2 @@ 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 @@ -23,6 +23,4 @@ #define QTOPIA_INTERNAL_FSLP -//#include <opie/ofiledialog.h> -#include <opie/ofileselector.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> @@ -166,33 +164,33 @@ 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()"); @@ -200,5 +198,5 @@ void CategoryTabWidget::addItem( const QString& linkfile ) void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, - AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) + AppLnkSet* docFolder, const QList<FileSystem> &fs) { QString current; @@ -254,21 +252,11 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 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)) ); @@ -286,18 +274,7 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 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 ) { @@ -342,8 +319,11 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) } -//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() @@ -364,5 +344,5 @@ void CategoryTabWidget::tabProperties() QString CategoryTabWidget::getAllDocLinkInfo() const { - return ""; + return docview->getAllDocLinkInfo(); } @@ -382,12 +362,13 @@ 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(); } @@ -407,5 +388,5 @@ void CategoryTabWidget::setBusy(bool 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); } @@ -668,5 +649,4 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) this, SLOT(properties(AppLnk*))); - #if !defined(QT_NO_COP) QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); @@ -753,4 +733,5 @@ 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" ) ); @@ -758,6 +739,8 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: owait->show(); qApp->processEvents(); - if(docsFolder) delete docsFolder; + + delete docsFolder; docsFolder = new DocLnkSet; + DocLnkSet *tmp = 0; QString home = QString(getenv("HOME")) + "/Documents"; @@ -782,9 +765,7 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: 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 @@ -805,6 +786,4 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: } } // done - owait->hide(); - delete owait; return; // save the else } @@ -870,4 +849,5 @@ void Launcher::updateTabs() { MimeType::updateApplications(); // ### reads all applnks twice + delete rootFolder; rootFolder = new AppLnkSet( MimeType::appsFolderName() ); @@ -881,5 +861,5 @@ void Launcher::updateDocs() { loadDocs(); - // tabs->updateDocs(docsFolder,storage->fileSystems()); + tabs->updateDocs(docsFolder,storage->fileSystems()); } @@ -1338,18 +1318,2 @@ void Launcher::preloadApps() } } - -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 @@ -12,4 +12,6 @@ using namespace OpieObex; +/* TRANSLATOR OpieObex::Obex */ + Obex::Obex( QObject *parent, const char* name ) : QObject(parent, name ) @@ -110,8 +112,4 @@ 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 ); @@ -126,11 +124,4 @@ void Obex::received() { 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 ); } 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 @@ -9,4 +9,6 @@ using namespace OpieObex; +/* TRANSLATOR OpieObex::ObexHandler */ + ObexHandler::ObexHandler() { m_wasRec = false; 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 @@ -4,4 +4,6 @@ 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 @@ -16,4 +16,6 @@ using namespace OpieObex; +/* TRANSLATOR OpieObex::SendWidget */ + SendWidget::SendWidget( QWidget* parent, const char* 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 @@ -2,4 +2,5 @@ #include <sys/stat.h> #include <sys/mman.h> +#include <stdlib.h> // int system #include <unistd.h> @@ -10,4 +11,5 @@ #include <qlabel.h> #include <qhbox.h> +#include <qregexp.h> #include <qtextview.h> #include <qpushbutton.h> @@ -16,4 +18,5 @@ #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> +#include <qpe/global.h> #include "obex.h" @@ -22,4 +25,6 @@ using namespace OpieObex; +/* TRANSLATOR OpieObex::Receiver */ + Receiver::Receiver() { m_obex = new Obex(this, "Receiver"); @@ -32,5 +37,6 @@ Receiver::~Receiver() { 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 ) @@ -60,19 +66,56 @@ void Receiver::handleOther( const QString& other ) { 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() @@ -134,4 +177,8 @@ 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; @@ -150,23 +197,7 @@ QString OtherHandler::targetName( const QString& file ) { 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 @@ -22,7 +22,10 @@ namespace OpieObex { 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: |