summaryrefslogtreecommitdiff
path: root/core
Unidiff
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
@@ -119,24 +119,14 @@ void BatteryMeter::paintEvent( QPaintEvent* )
119 if ( style == 1 ) 119 if ( style == 1 )
120 { 120 {
121 QPainter p(this); 121 QPainter p(this);
122 QFont f( "Fixed", AppLnk::smallIconSize()/2 ); 122 QFont f( "Fixed", AppLnk::smallIconSize()/2 );
123 QFontMetrics fm( f ); 123 QFontMetrics fm( f );
124 p.setFont( f ); 124 p.setFont( f );
125 if ( percent > 98 ) {
126 p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "F" ) );
127 }
128 else if ( percent < 5 )
129 {
130 p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "E" ) );
131 }
132 else
133 {
134 p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); 125 p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) );
135 p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); 126 p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" );
136 }
137 return; 127 return;
138 } 128 }
139 129
140 QPainter p(this); 130 QPainter p(this);
141 QColor color; 131 QColor color;
142 QColor g = gray.light( 160 ); 132 QColor g = gray.light( 160 );
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
@@ -237,13 +237,13 @@ void BatteryStatus::paintEvent( QPaintEvent * ) {
237 jacketMsg = tr("Jacket " + jackChem); 237 jacketMsg = tr("Jacket " + jackChem);
238 } else { 238 } else {
239 jackPercent = 0; 239 jackPercent = 0;
240 jacketMsg = tr("No jacket with battery inserted"); 240 jacketMsg = tr("No jacket with battery inserted");
241 } 241 }
242 242
243 int jackPerc = ( jackPercent / 100.0 ) * screenWidth - 47; 243 int jackPerc = ( jackPercent / 100.0 ) * ( screenWidth - 47 ) ;
244 244
245 qDrawShadePanel( &p, 9, 160, rightEnd1, 39, colorGroup(), TRUE, 1, NULL); 245 qDrawShadePanel( &p, 9, 160, rightEnd1, 39, colorGroup(), TRUE, 1, NULL);
246 qDrawShadePanel( &p, rightEnd2, 167, 12, 24, colorGroup(), TRUE, 1, NULL); 246 qDrawShadePanel( &p, rightEnd2, 167, 12, 24, colorGroup(), TRUE, 1, NULL);
247 drawSegment( &p, QRect( 10, 160, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 ); 247 drawSegment( &p, QRect( 10, 160, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 );
248 drawSegment( &p, QRect( 11 + jackPerc, 160, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 ); 248 drawSegment( &p, QRect( 11 + jackPerc, 160, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 );
249 drawSegment( &p, QRect( rightEnd2, 167, 10, 25 ), white.light(80), black, white.light(90), 2 ); 249 drawSegment( &p, QRect( rightEnd2, 167, 10, 25 ), white.light(80), black, white.light(90), 2 );
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
@@ -269,13 +269,15 @@ bool CardMonitor::getStatusPcmcia(int showPopUp)
269 text += tr("Ejected: "); 269 text += tr("Ejected: ");
270 what = "off"; 270 what = "off";
271 } 271 }
272 text += cardInPcmcia1Name; 272 text += cardInPcmcia1Name;
273 popUp(text, "cardmon/" + cardInPcmcia1Type); 273 popUp(text, "cardmon/" + cardInPcmcia1Type);
274 } 274 }
275#ifndef QT_NO_SOUND
275 QSound::play(Resource::findSound("cardmon/card" + what)); 276 QSound::play(Resource::findSound("cardmon/card" + what));
277#endif
276 } 278 }
277 } else { 279 } else {
278 // no file found 280 // no file found
279 qDebug("no file found"); 281 qDebug("no file found");
280 cardInPcmcia0 = FALSE; 282 cardInPcmcia0 = FALSE;
281 cardInPcmcia1 = FALSE; 283 cardInPcmcia1 = FALSE;
@@ -321,13 +323,15 @@ bool CardMonitor::getStatusSd(int showPopUp)
321 what = "on"; 323 what = "on";
322 } else { 324 } else {
323 text += "Ejected: SD/MMC"; 325 text += "Ejected: SD/MMC";
324 what = "off"; 326 what = "off";
325 } 327 }
326 //qDebug("TEXT: " + text ); 328 //qDebug("TEXT: " + text );
329#ifndef QT_NO_SOUND
327 QSound::play(Resource::findSound("cardmon/card" + what)); 330 QSound::play(Resource::findSound("cardmon/card" + what));
331#endif
328 popUp(text, "cardmon/ide");// XX add SD pic 332 popUp(text, "cardmon/ide");// XX add SD pic
329 } 333 }
330#else 334#else
331#error "Not on Linux" 335#error "Not on Linux"
332#endif 336#endif
333 repaint( FALSE ); 337 repaint( FALSE );
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
@@ -1,7 +1,6 @@
1*.moc 1*.moc
2*.~ 2*.~
3Makefile* 3Makefile*
4config.in 4config.in
5moc_* 5moc_*
6opieobjconfig.in 6opieobjconfig.in
7opieobj
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
@@ -19,14 +19,12 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT 21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class. 22// have this class.
23#define QTOPIA_INTERNAL_FSLP 23#define QTOPIA_INTERNAL_FSLP
24 24
25//#include <opie/ofiledialog.h>
26#include <opie/ofileselector.h>
27#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
28#include <qpe/resource.h> 26#include <qpe/resource.h>
29#include <qpe/applnk.h> 27#include <qpe/applnk.h>
30#include <qpe/config.h> 28#include <qpe/config.h>
31#include <qpe/global.h> 29#include <qpe/global.h>
32#include <qpe/qpeapplication.h> 30#include <qpe/qpeapplication.h>
@@ -162,47 +160,47 @@ void CategoryTabWidget::showTab(const QString& id)
162 categoryBar->setCurrentTab( idx ); 160 categoryBar->setCurrentTab( idx );
163 } 161 }
164} 162}
165 163
166void CategoryTabWidget::addItem( const QString& linkfile ) 164void CategoryTabWidget::addItem( const QString& linkfile )
167{ 165{
168// int i=0; 166 int i=0;
169// AppLnk *app = new AppLnk(linkfile); 167 AppLnk *app = new AppLnk(linkfile);
170// if ( !app->isValid() ) { 168 if ( !app->isValid() ) {
171// delete app; 169 delete app;
172// app=0; 170 app=0;
173// } 171 }
174// if ( !app || !app->file().isEmpty() ) { 172 if ( !app || !app->file().isEmpty() ) {
175 // A document 173 // A document
176// delete app; 174 delete app;
177// app = new DocLnk(linkfile); 175 app = new DocLnk(linkfile);
178// if ( app->fileKnown() ) { 176 if ( app->fileKnown() ) {
179// ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); 177 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
180// } else { 178 } else {
181// ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); 179 ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
182// delete app; 180 delete app;
183// } 181 }
184// return; 182 return;
185// } 183 }
186 // An application 184 // An application
187// for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { 185 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
188// if ( !(*it).isEmpty() ) { 186 if ( !(*it).isEmpty() ) {
189// QRegExp tf(*it,FALSE,TRUE); 187 QRegExp tf(*it,FALSE,TRUE);
190// if ( tf.match(app->type()) >= 0 ) { 188 if ( tf.match(app->type()) >= 0 ) {
191// ((LauncherView*)stack->widget(i))->addItem(app); 189 ((LauncherView*)stack->widget(i))->addItem(app);
192// return; 190 return;
193// } 191 }
194// i++; 192 i++;
195 // } 193 }
196 // } 194 }
197 195
198 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 196 QCopEnvelope e("QPE/TaskBar","reloadApps()");
199} 197}
200 198
201void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 199void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
202 AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) 200 AppLnkSet* docFolder, const QList<FileSystem> &fs)
203{ 201{
204 QString current; 202 QString current;
205 if ( categoryBar ) { 203 if ( categoryBar ) {
206 int c = categoryBar->currentTab(); 204 int c = categoryBar->currentTab();
207 if ( c >= 0 ) current = ids[c]; 205 if ( c >= 0 ) current = ids[c];
208 } 206 }
@@ -250,29 +248,19 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
250 ((LauncherView*)stack->widget(i))->sort(); 248 ((LauncherView*)stack->widget(i))->sort();
251 249
252 // all documents 250 // all documents
253 QImage img( Resource::loadImage( "DocsIcon" ) ); 251 QImage img( Resource::loadImage( "DocsIcon" ) );
254 QPixmap pm; 252 QPixmap pm;
255 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 253 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
256 254 docview = newView( "Documents", // No tr
257 //ljpotter 255 pm, tr("Documents"));
258 CategoryTab *catTab ; 256 docview->populate( docFolder, QString::null );
259 catTab = new CategoryTab( pm, "Documents" ); 257 docFolder->detachChildren();
260 258 docview->setFileSystems(fs);
261 categoryBar->addTab( catTab ); 259 docview->setToolsEnabled(TRUE);
262 260 setTabAppearance( "Documents", cfg ); // No tr
263 fileSel = new DocumentTab( stack, 4, 0, "/","");
264 stack->addWidget( fileSel, tabs++ );
265
266 // fileSel->hide();
267
268 connect( fileSel, SIGNAL( fileSelected( const DocLnk & )),
269 this, SLOT(clickie(const DocLnk&)) );
270
271// connect( fileSel, SIGNAL( fileSelected( const QString & )),
272// this, SLOT(clickie(const QString&)) );
273 261
274 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); 262 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
275 263
276 ((LauncherView*)stack->widget(0))->setFocus(); 264 ((LauncherView*)stack->widget(0))->setFocus();
277 265
278 cfg. setGroup ( "GUI" ); 266 cfg. setGroup ( "GUI" );
@@ -282,26 +270,15 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
282 showTab(current); 270 showTab(current);
283 } 271 }
284 272
285 categoryBar->show(); 273 categoryBar->show();
286 stack->show(); 274 stack->show();
287 275
288
289 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 276 QCopEnvelope e("QPE/TaskBar","reloadApps()");
290} 277}
291 278
292void CategoryTabWidget::clickie(const DocLnk &lnk) {
293 lnk.execute();
294 // fileSel->reparse();
295}
296
297void CategoryTabWidget::clickie(const QString &appStr) {
298// DocLnk lnk(appStr);
299// lnk.execute();
300}
301
302void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) 279void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
303{ 280{
304 QString grp( "Tab %1" ); // No tr 281 QString grp( "Tab %1" ); // No tr
305 cfg.setGroup( grp.arg(id) ); 282 cfg.setGroup( grp.arg(id) );
306 LauncherView *v = view( id ); 283 LauncherView *v = view( id );
307 int idx = ids.findIndex( id ); 284 int idx = ids.findIndex( id );
@@ -338,16 +315,19 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
338 if ( tabTextCol.isEmpty() ) 315 if ( tabTextCol.isEmpty() )
339 tab->fgColor = QColor(); 316 tab->fgColor = QColor();
340 else 317 else
341 tab->fgColor = QColor(tabTextCol); 318 tab->fgColor = QColor(tabTextCol);
342} 319}
343 320
344//void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) 321void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs)
345//{ 322{
346 // docFolder->detachChildren(); 323 docview->populate( docFolder, QString::null );
347//} 324 docFolder->detachChildren();
325 docview->setFileSystems(fs);
326 docview->updateTools();
327}
348 328
349void CategoryTabWidget::tabProperties() 329void CategoryTabWidget::tabProperties()
350{ 330{
351 LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); 331 LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() );
352 QPopupMenu *m = new QPopupMenu( this ); 332 QPopupMenu *m = new QPopupMenu( this );
353 m->insertItem( tr("Icon View"), LauncherView::Icon ); 333 m->insertItem( tr("Icon View"), LauncherView::Icon );
@@ -360,13 +340,13 @@ void CategoryTabWidget::tabProperties()
360 340
361 delete m; 341 delete m;
362} 342}
363 343
364QString CategoryTabWidget::getAllDocLinkInfo() const 344QString CategoryTabWidget::getAllDocLinkInfo() const
365{ 345{
366 return ""; 346 return docview->getAllDocLinkInfo();
367} 347}
368 348
369LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 349LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
370{ 350{
371 LauncherView* view = new LauncherView( stack ); 351 LauncherView* view = new LauncherView( stack );
372 connect( view, SIGNAL(clicked(const AppLnk*)), 352 connect( view, SIGNAL(clicked(const AppLnk*)),
@@ -378,20 +358,21 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm,
378 stack->addWidget( view, tabs++ ); 358 stack->addWidget( view, tabs++ );
379 return view; 359 return view;
380} 360}
381 361
382void CategoryTabWidget::updateLink(const QString& linkfile) 362void CategoryTabWidget::updateLink(const QString& linkfile)
383{ 363{
384 // LauncherView* view; 364 int i=0;
385 qApp->processEvents(); 365 LauncherView* view;
386// while ((view = (LauncherView*)stack->widget(i++))) { 366 //qApp->processEvents();
387// if ( view->removeLink(linkfile) ) 367 while ((view = (LauncherView*)stack->widget(i++))) {
388// break; 368 if ( view->removeLink(linkfile) )
389// } 369 break;
390 // addItem(linkfile); 370 }
391 fileSel->reparse(); 371 addItem(linkfile);
372 docview->updateTools();
392} 373}
393 374
394void CategoryTabWidget::paletteChange( const QPalette &p ) 375void CategoryTabWidget::paletteChange( const QPalette &p )
395{ 376{
396 QVBox::paletteChange( p ); 377 QVBox::paletteChange( p );
397 QPalette pal = palette(); 378 QPalette pal = palette();
@@ -403,13 +384,13 @@ void CategoryTabWidget::paletteChange( const QPalette &p )
403 384
404void CategoryTabWidget::setBusy(bool on) 385void CategoryTabWidget::setBusy(bool on)
405{ 386{
406 if ( on ) 387 if ( on )
407 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); 388 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
408 else 389 else
409 for (int i=0; i<tabs-1; i++) 390 for (int i=0; i<tabs; i++)
410 ((LauncherView*)stack->widget(i))->setBusy(FALSE); 391 ((LauncherView*)stack->widget(i))->setBusy(FALSE);
411} 392}
412 393
413LauncherView *CategoryTabWidget::view( const QString &id ) 394LauncherView *CategoryTabWidget::view( const QString &id )
414{ 395{
415 int idx = ids.findIndex( id ); 396 int idx = ids.findIndex( id );
@@ -664,13 +645,12 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
664 this, SLOT(viewSelected(const QString&)) ); 645 this, SLOT(viewSelected(const QString&)) );
665 connect( tabs, SIGNAL(clicked(const AppLnk*)), 646 connect( tabs, SIGNAL(clicked(const AppLnk*)),
666 this, SLOT(select(const AppLnk*))); 647 this, SLOT(select(const AppLnk*)));
667 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 648 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
668 this, SLOT(properties(AppLnk*))); 649 this, SLOT(properties(AppLnk*)));
669 650
670
671#if !defined(QT_NO_COP) 651#if !defined(QT_NO_COP)
672 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 652 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
673 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 653 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
674 this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); 654 this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
675 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 655 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
676 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 656 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
@@ -749,19 +729,22 @@ void Launcher::updateMimeTypes(AppLnkSet* folder)
749 * c) the user enabled medium checking on a per medium bases 729 * c) the user enabled medium checking on a per medium bases
750 * c1) we already checked and its not ask again turns 730 * c1) we already checked and its not ask again turns
751 * c2) we need to ask and then apply the mimefilter 731 * c2) we need to ask and then apply the mimefilter
752 */ 732 */
753void Launcher::loadDocs() // ok here comes a hack belonging to Global:: 733void Launcher::loadDocs() // ok here comes a hack belonging to Global::
754{ 734{
735
755 OWait *owait = new OWait(); 736 OWait *owait = new OWait();
756 Global::statusMessage( tr( "Finding documents" ) ); 737 Global::statusMessage( tr( "Finding documents" ) );
757 738
758 owait->show(); 739 owait->show();
759 qApp->processEvents(); 740 qApp->processEvents();
760 if(docsFolder) delete docsFolder; 741
742 delete docsFolder;
761 docsFolder = new DocLnkSet; 743 docsFolder = new DocLnkSet;
744
762 DocLnkSet *tmp = 0; 745 DocLnkSet *tmp = 0;
763 QString home = QString(getenv("HOME")) + "/Documents"; 746 QString home = QString(getenv("HOME")) + "/Documents";
764 tmp = new DocLnkSet( home , QString::null); 747 tmp = new DocLnkSet( home , QString::null);
765 docsFolder->appendFrom( *tmp ); 748 docsFolder->appendFrom( *tmp );
766 delete tmp; 749 delete tmp;
767 750
@@ -778,17 +761,15 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
778 } 761 }
779 } 762 }
780 763
781 Config mediumCfg( "medium"); 764 Config mediumCfg( "medium");
782 mediumCfg.setGroup("main"); 765 mediumCfg.setGroup("main");
783 // a) -zecke we don't want to check 766 // a) -zecke we don't want to check
784 if(!mediumCfg.readBoolEntry("use", true ) ) { 767 if(!mediumCfg.readBoolEntry("use", true ) )
785 owait->hide();
786 delete owait;
787 return; 768 return;
788 } 769
789 // find out wich filesystems are new in this round 770 // find out wich filesystems are new in this round
790 // We will do this by having a timestamp inside each mountpoint 771 // We will do this by having a timestamp inside each mountpoint
791 // if the current timestamp doesn't match this is a new file system and 772 // if the current timestamp doesn't match this is a new file system and
792 // come up with our MediumMountGui :) let the hacking begin 773 // come up with our MediumMountGui :) let the hacking begin
793 int stamp = uidgen.generate(); 774 int stamp = uidgen.generate();
794 775
@@ -801,14 +782,12 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
801 if( (*it)->isRemovable() ){ 782 if( (*it)->isRemovable() ){
802 tmp = new DocLnkSet( (*it)->path(), mime ); 783 tmp = new DocLnkSet( (*it)->path(), mime );
803 docsFolder->appendFrom( *tmp ); 784 docsFolder->appendFrom( *tmp );
804 delete tmp; 785 delete tmp;
805 } 786 }
806 } // done 787 } // done
807 owait->hide();
808 delete owait;
809 return; // save the else 788 return; // save the else
810 } 789 }
811 // c) zecke 790 // c) zecke
812 for ( it.toFirst(); it.current(); ++it ) { 791 for ( it.toFirst(); it.current(); ++it ) {
813 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 792 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
814 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); 793 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File);
@@ -866,24 +845,25 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
866 delete owait; 845 delete owait;
867} 846}
868 847
869void Launcher::updateTabs() 848void Launcher::updateTabs()
870{ 849{
871 MimeType::updateApplications(); // ### reads all applnks twice 850 MimeType::updateApplications(); // ### reads all applnks twice
851
872 delete rootFolder; 852 delete rootFolder;
873 rootFolder = new AppLnkSet( MimeType::appsFolderName() ); 853 rootFolder = new AppLnkSet( MimeType::appsFolderName() );
874 854
875 loadDocs(); 855 loadDocs();
876 856
877 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); 857 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
878} 858}
879 859
880void Launcher::updateDocs() 860void Launcher::updateDocs()
881{ 861{
882 loadDocs(); 862 loadDocs();
883 // tabs->updateDocs(docsFolder,storage->fileSystems()); 863 tabs->updateDocs(docsFolder,storage->fileSystems());
884} 864}
885 865
886void Launcher::viewSelected(const QString& s) 866void Launcher::viewSelected(const QString& s)
887{ 867{
888 setCaption( s + tr(" - Launcher") ); 868 setCaption( s + tr(" - Launcher") );
889} 869}
@@ -1334,22 +1314,6 @@ void Launcher::preloadApps()
1334 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { 1314 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
1335#ifndef QT_NO_COP 1315#ifndef QT_NO_COP
1336 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); 1316 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
1337#endif 1317#endif
1338 } 1318 }
1339} 1319}
1340
1341DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName)
1342 : OFileSelector(parent,mode,selector,dirName,fileName)
1343{
1344 setYesCancelVisible(false);
1345 setToolbarVisible(false);
1346 setPermissionBarVisible(false);
1347 setLineEditVisible(false) ;
1348 //setChooserVisible( bool chooser );
1349
1350}
1351
1352DocumentTab::~DocumentTab() {
1353
1354}
1355
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
@@ -8,12 +8,14 @@
8 8
9#include <opie/oprocess.h> 9#include <opie/oprocess.h>
10#include "obex.h" 10#include "obex.h"
11 11
12using namespace OpieObex; 12using namespace OpieObex;
13 13
14/* TRANSLATOR OpieObex::Obex */
15
14Obex::Obex( QObject *parent, const char* name ) 16Obex::Obex( QObject *parent, const char* name )
15 : QObject(parent, name ) 17 : QObject(parent, name )
16{ 18{
17 m_rec = 0; 19 m_rec = 0;
18 m_send=0; 20 m_send=0;
19 m_count = 0; 21 m_count = 0;
@@ -106,35 +108,24 @@ void Obex::slotExited(OProcess* proc ){
106 }else if ( proc == m_send ) { 108 }else if ( proc == m_send ) {
107 sendEnd(); 109 sendEnd();
108 } 110 }
109} 111}
110void Obex::slotStdOut(OProcess* proc, char* buf, int len){ 112void Obex::slotStdOut(OProcess* proc, char* buf, int len){
111 if ( proc == m_rec ) { // only receive 113 if ( proc == m_rec ) { // only receive
112 for (int i = 0; i < len; i++ ) {
113 printf("%c", buf[i] );
114 }
115 printf("\n");
116 QByteArray ar( len ); 114 QByteArray ar( len );
117 memcpy( ar.data(), buf, len ); 115 memcpy( ar.data(), buf, len );
118 qWarning("parsed: %s", ar.data() ); 116 qWarning("parsed: %s", ar.data() );
119 m_outp.append( ar ); 117 m_outp.append( ar );
120 } 118 }
121} 119}
122 120
123void Obex::received() { 121void Obex::received() {
124 if (m_rec->normalExit() ) { 122 if (m_rec->normalExit() ) {
125 if ( m_rec->exitStatus() == 0 ) { // we got one 123 if ( m_rec->exitStatus() == 0 ) { // we got one
126 QString filename = parseOut(); 124 QString filename = parseOut();
127 qWarning("ACHTUNG %s", filename.latin1() ); 125 qWarning("ACHTUNG %s", filename.latin1() );
128 if (filename.contains( 'ö' ) || filename.contains( 'ä' ) || filename.contains('ü' ) ) {
129 qWarning("renaming!!!!");
130 QFileInfo inf( filename );
131 QString newName = "/tmp/opie-obex." + inf.extension();
132 ::rename( QFile::encodeName( filename ).data(), newName );
133 qWarning("name is %s", QFile::encodeName( filename ).data() );
134 }
135 emit receivedFile( filename ); 126 emit receivedFile( filename );
136 } 127 }
137 }else{ 128 }else{
138 emit done(false); 129 emit done(false);
139 }; 130 };
140 delete m_rec; 131 delete m_rec;
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
@@ -5,12 +5,14 @@
5#include "obexsend.h" 5#include "obexsend.h"
6#include "receiver.h" 6#include "receiver.h"
7#include "obexhandler.h" 7#include "obexhandler.h"
8 8
9using namespace OpieObex; 9using namespace OpieObex;
10 10
11/* TRANSLATOR OpieObex::ObexHandler */
12
11ObexHandler::ObexHandler() { 13ObexHandler::ObexHandler() {
12 m_wasRec = false; 14 m_wasRec = false;
13 m_sender = 0l; 15 m_sender = 0l;
14 m_receiver = 0l; 16 m_receiver = 0l;
15 QCopChannel* chan = new QCopChannel("QPE/Obex"); 17 QCopChannel* chan = new QCopChannel("QPE/Obex");
16 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 18 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
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
@@ -1,11 +1,13 @@
1#include "obexhandler.h" 1#include "obexhandler.h"
2#include "obeximpl.h" 2#include "obeximpl.h"
3 3
4using namespace OpieObex; 4using namespace OpieObex;
5 5
6/* TRANSLATOR OpieObex::ObexImpl */
7
6ObexImpl::ObexImpl() { 8ObexImpl::ObexImpl() {
7 m_handler = new ObexHandler; 9 m_handler = new ObexHandler;
8} 10}
9ObexImpl::~ObexImpl() { 11ObexImpl::~ObexImpl() {
10 delete m_handler; 12 delete m_handler;
11} 13}
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
@@ -12,12 +12,14 @@
12 12
13#include "obex.h" 13#include "obex.h"
14#include "obexsend.h" 14#include "obexsend.h"
15 15
16using namespace OpieObex; 16using namespace OpieObex;
17 17
18/* TRANSLATOR OpieObex::SendWidget */
19
18 20
19SendWidget::SendWidget( QWidget* parent, const char* name ) 21SendWidget::SendWidget( QWidget* parent, const char* name )
20 : QWidget( parent, name ) { 22 : QWidget( parent, name ) {
21 initUI(); 23 initUI();
22} 24}
23SendWidget::~SendWidget() { 25SendWidget::~SendWidget() {
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,40 +1,46 @@
1#include <sys/types.h> 1#include <sys/types.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/mman.h> 3#include <sys/mman.h>
4#include <stdlib.h> // int system
4#include <unistd.h> 5#include <unistd.h>
5 6
6#include <fcntl.h> 7#include <fcntl.h>
7 8
8#include <qfile.h> 9#include <qfile.h>
9#include <qfileinfo.h> 10#include <qfileinfo.h>
10#include <qlabel.h> 11#include <qlabel.h>
11#include <qhbox.h> 12#include <qhbox.h>
13#include <qregexp.h>
12#include <qtextview.h> 14#include <qtextview.h>
13#include <qpushbutton.h> 15#include <qpushbutton.h>
14 16
15#include <qpe/applnk.h> 17#include <qpe/applnk.h>
16#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
17#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20#include <qpe/global.h>
18 21
19#include "obex.h" 22#include "obex.h"
20#include "receiver.h" 23#include "receiver.h"
21 24
22using namespace OpieObex; 25using namespace OpieObex;
23 26
27/* TRANSLATOR OpieObex::Receiver */
28
24Receiver::Receiver() { 29Receiver::Receiver() {
25 m_obex = new Obex(this, "Receiver"); 30 m_obex = new Obex(this, "Receiver");
26 connect(m_obex, SIGNAL(receivedFile(const QString& ) ), 31 connect(m_obex, SIGNAL(receivedFile(const QString& ) ),
27 this, SLOT(slotReceived(const QString& ) ) ); 32 this, SLOT(slotReceived(const QString& ) ) );
28 m_obex->receive(); 33 m_obex->receive();
29} 34}
30Receiver::~Receiver() { 35Receiver::~Receiver() {
31 m_obex->setReceiveEnabled( false ); 36 m_obex->setReceiveEnabled( false );
32 delete m_obex; 37 delete m_obex;
33} 38}
34void Receiver::slotReceived( const QString& file ) { 39void Receiver::slotReceived( const QString& _file ) {
40 QString file = _file;
35 int check = checkFile(file); 41 int check = checkFile(file);
36 if ( check == AddressBook ) 42 if ( check == AddressBook )
37 handleAddr( file ); 43 handleAddr( file );
38 else if ( check == Datebook ) 44 else if ( check == Datebook )
39 handleDateTodo( file ); 45 handleDateTodo( file );
40 else 46 else
@@ -56,27 +62,64 @@ void Receiver::handleDateTodo( const QString& str ) {
56 * beamed object and creates a DocLnk 62 * beamed object and creates a DocLnk
57 */ 63 */
58void Receiver::handleOther( const QString& other ) { 64void Receiver::handleOther( const QString& other ) {
59 OtherHandler* hand = new OtherHandler(); 65 OtherHandler* hand = new OtherHandler();
60 hand->handle( other ); 66 hand->handle( other );
61} 67}
62int Receiver::checkFile( const QString& file ) { 68void Receiver::tidyUp( QString& _file, const QString& ending) {
69 /* libversit fails on BASE64 encoding we try to sed it away */
70 QString file = _file;
71 char foo[24]; // big enough
72 (void)::strcpy(foo, "/tmp/opie-XXXXXX");
73
74 int fd = ::mkstemp(foo);
75
76 if ( fd == -1 )
77 return;
78
79 (void)::strncat( foo, ending.latin1(), 4 );
80 _file = QString::fromLatin1( foo );
81 QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) );
82 qWarning("Executing: %s", cmd.latin1() );
83 (void)::system( cmd.latin1() );
84
85 cmd = QString("rm %1").arg( Global::shellQuote(file) );
86 (void)::system( cmd.latin1() );
87}
88int Receiver::checkFile( QString& file ) {
63 qWarning("check file!! %s", file.latin1() ); 89 qWarning("check file!! %s", file.latin1() );
64 int ret; 90 int ret;
91 QString ending;
92
65 if (file.right(4) == ".vcs" ) { 93 if (file.right(4) == ".vcs" ) {
66 ret = Datebook; 94 ret = Datebook;
95 ending = QString::fromLatin1(".vcs");
67 }else if ( file.right(4) == ".vcf") { 96 }else if ( file.right(4) == ".vcf") {
68 ret = AddressBook; 97 ret = AddressBook;
98 ending = QString::fromLatin1(".vcf");
69 }else 99 }else
70 ret = Other; 100 ret = Other;
71 101
72 102
103 if (ending.isEmpty() )
104 return ret;
105
106 /**
107 * currently the parser is broken in regard of BASE64 encoding
108 * and M$ likes to send that. So we will executed a small
109 * tidy up system sed script
110 * At this point we can also remove umlaute from the filename
111 */
112 tidyUp( file, ending );
113
73 qWarning("check it now %d", ret ); 114 qWarning("check it now %d", ret );
74 return ret; 115 return ret;
75} 116}
76 117
118/* TRANSLATOR OpieObex::OtherHandler */
119
77OtherHandler::OtherHandler() 120OtherHandler::OtherHandler()
78 : QVBox() 121 : QVBox()
79{ 122{
80 QHBox* box = new QHBox(this); 123 QHBox* box = new QHBox(this);
81 QLabel* lbl = new QLabel(box); 124 QLabel* lbl = new QLabel(box);
82 lbl->setText(tr("<qt><b>Received:</b></qt>")); 125 lbl->setText(tr("<qt><b>Received:</b></qt>"));
@@ -130,12 +173,16 @@ void OtherHandler::accept() {
130void OtherHandler::deny() { 173void OtherHandler::deny() {
131 QFile::remove( m_file ); 174 QFile::remove( m_file );
132 delete this; 175 delete this;
133} 176}
134QString OtherHandler::targetName( const QString& file ) { 177QString OtherHandler::targetName( const QString& file ) {
135 QFileInfo info( file ); 178 QFileInfo info( file );
179
180 /* $HOME needs to be set!!!! */
181 Global::createDocDir();
182
136 QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); 183 QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName();
137 QString newFileBase = newFile; 184 QString newFileBase = newFile;
138 185
139 int trie = 0; 186 int trie = 0;
140 while (QFile::exists(newFile + "."+info.extension() ) ) { 187 while (QFile::exists(newFile + "."+info.extension() ) ) {
141 newFile = newFileBase + "_"+QString::number(trie) ; 188 newFile = newFileBase + "_"+QString::number(trie) ;
@@ -146,27 +193,11 @@ QString OtherHandler::targetName( const QString& file ) {
146 return newFile; 193 return newFile;
147} 194}
148 195
149/* fast cpy */ 196/* fast cpy */
150void OtherHandler::copy(const QString& src, const QString& file) { 197void OtherHandler::copy(const QString& src, const QString& file) {
151 qWarning("src %s, dest %s", src.latin1(),file.latin1() ); 198 qWarning("src %s, dest %s", src.latin1(),file.latin1() );
152 int src_fd = ::open( QFile::encodeName( src ), O_RDONLY ); 199 QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )).
153 int to_fd = ::open( QFile::encodeName( file), O_RDWR| O_CREAT| O_TRUNC, 200 arg( Global::shellQuote( file ) );
154 S_IRUSR, S_IWUSR, S_IRGRP, S_IRGRP ); 201 ::system( cmd.latin1() );
155
156 struct stat stater;
157 ::fstat(src_fd, &stater );
158 ::lseek(to_fd, stater.st_size-1, SEEK_SET );
159 ::write(to_fd, "", 1 );
160
161 void *src_addr, *dest_addr;
162 src_addr = ::mmap(0, stater.st_size, PROT_READ,
163 MAP_FILE | MAP_SHARED, src_fd, 0 );
164 dest_addr= ::mmap(0, stater.st_size, PROT_READ | PROT_WRITE,
165 MAP_FILE | MAP_PRIVATE, to_fd, 0 );
166
167 ::memcpy(dest_addr , src_addr, stater.st_size );
168 ::munmap(src_addr , stater.st_size );
169 ::munmap(dest_addr, stater.st_size );
170
171 // done 202 // done
172} 203}
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
@@ -18,15 +18,18 @@ namespace OpieObex {
18 ~Receiver(); 18 ~Receiver();
19 19
20 private: 20 private:
21 void handleAddr(const QString& ); 21 void handleAddr(const QString& );
22 void handleDateTodo(const QString& ); 22 void handleDateTodo(const QString& );
23 void handleOther(const QString& ); 23 void handleOther(const QString& );
24 int checkFile( const QString& file ); 24 /* will alter the file name */
25 int checkFile( QString& file );
25 bool testDateTodo(const QString& file); 26 bool testDateTodo(const QString& file);
26 bool testAddressbook(const QString& file); 27 bool testAddressbook(const QString& file);
28 /* called by checkFile */
29 void tidyUp( QString& file, const QString& ending );
27 30
28 private slots: 31 private slots:
29 void slotReceived( const QString& ); 32 void slotReceived( const QString& );
30 33
31 private: 34 private:
32 Obex* m_obex; 35 Obex* m_obex;