summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookmonth.cpp28
-rw-r--r--library/fileselector.cpp16
-rw-r--r--library/finddialog.cpp12
-rw-r--r--library/findwidget_p.cpp4
-rw-r--r--library/ir.cpp4
-rw-r--r--library/network.cpp4
-rw-r--r--library/qcopenvelope_qws.cpp4
-rw-r--r--library/qpeapplication.cpp12
-rw-r--r--library/qpedialog.cpp4
-rw-r--r--library/storage.cpp4
-rw-r--r--library/timestring.cpp2
-rw-r--r--library/tzselect.cpp8
12 files changed, 49 insertions, 53 deletions
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp
index 76e022f..421559e 100644
--- a/library/datebookmonth.cpp
+++ b/library/datebookmonth.cpp
@@ -24,99 +24,99 @@
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27#include <qspinbox.h> 27#include <qspinbox.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qvaluestack.h> 29#include <qvaluestack.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31 31
32 32
33DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name ) 33DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name )
34 : QHBox( parent, name ) 34 : QHBox( parent, name )
35{ 35{
36 setBackgroundMode( PaletteButton ); 36 setBackgroundMode( PaletteButton );
37 37
38 begin = new QToolButton( this ); 38 begin = new QToolButton( this );
39 begin->setFocusPolicy(NoFocus); 39 begin->setFocusPolicy(NoFocus);
40 begin->setPixmap( Resource::loadPixmap( "start" ) ); 40 begin->setPixmap( Resource::loadPixmap( "start" ) );
41 begin->setAutoRaise( TRUE ); 41 begin->setAutoRaise( TRUE );
42 begin->setFixedSize( begin->sizeHint() ); 42 begin->setFixedSize( begin->sizeHint() );
43 QWhatsThis::add( begin, tr("Show January in the selected year") ); 43 QWhatsThis::add( begin, tr("Show January in the selected year") );
44 44
45 back = new QToolButton( this ); 45 back = new QToolButton( this );
46 back->setFocusPolicy(NoFocus); 46 back->setFocusPolicy(NoFocus);
47 back->setPixmap( Resource::loadPixmap( "back" ) ); 47 back->setPixmap( Resource::loadPixmap( "back" ) );
48 back->setAutoRaise( TRUE ); 48 back->setAutoRaise( TRUE );
49 back->setFixedSize( back->sizeHint() ); 49 back->setFixedSize( back->sizeHint() );
50 QWhatsThis::add( back, tr("Show the previous month") ); 50 QWhatsThis::add( back, tr("Show the previous month") );
51 51
52 month = new QComboBox( FALSE, this ); 52 month = new QComboBox( FALSE, this );
53 for ( int i = 0; i < 12; ++i ) 53 for ( int i = 0; i < 12; ++i )
54 month->insertItem( Calendar::nameOfMonth( i + 1 ) ); 54 month->insertItem( Calendar::nameOfMonth( i + 1 ) );
55 55
56 year = new QSpinBox( 1752, 8000, 1, this ); 56 year = new QSpinBox( 1752, 8000, 1, this );
57 57
58 next = new QToolButton( this ); 58 next = new QToolButton( this );
59 next->setFocusPolicy(NoFocus); 59 next->setFocusPolicy(NoFocus);
60 next->setPixmap( Resource::loadPixmap( "forward" ) ); 60 next->setPixmap( Resource::loadPixmap( "forward" ) );
61 next->setAutoRaise( TRUE ); 61 next->setAutoRaise( TRUE );
62 next->setFixedSize( next->sizeHint() ); 62 next->setFixedSize( next->sizeHint() );
63 QWhatsThis::add( next, tr("Show the next month") ); 63 QWhatsThis::add( next, tr("Show the next month") );
64 64
65 end = new QToolButton( this ); 65 end = new QToolButton( this );
66 end->setFocusPolicy(NoFocus); 66 end->setFocusPolicy(NoFocus);
67 end->setPixmap( Resource::loadPixmap( "finish" ) ); 67 end->setPixmap( Resource::loadPixmap( "finish" ) );
68 end->setAutoRaise( TRUE ); 68 end->setAutoRaise( TRUE );
69 end->setFixedSize( end->sizeHint() ); 69 end->setFixedSize( end->sizeHint() );
70 QWhatsThis::add( end, tr("Show December in the selected year") ); 70 QWhatsThis::add( end, tr("Show December in the selected year") );
71 71
72 connect( month, SIGNAL( activated( int ) ), 72 connect( month, SIGNAL( activated(int) ),
73 this, SLOT( updateDate() ) ); 73 this, SLOT( updateDate() ) );
74 connect( year, SIGNAL( valueChanged( int ) ), 74 connect( year, SIGNAL( valueChanged(int) ),
75 this, SLOT( updateDate() ) ); 75 this, SLOT( updateDate() ) );
76 connect( begin, SIGNAL( clicked() ), 76 connect( begin, SIGNAL( clicked() ),
77 this, SLOT( firstMonth() ) ); 77 this, SLOT( firstMonth() ) );
78 connect( end, SIGNAL( clicked() ), 78 connect( end, SIGNAL( clicked() ),
79 this, SLOT( lastMonth() ) ); 79 this, SLOT( lastMonth() ) );
80 connect( back, SIGNAL( clicked() ), 80 connect( back, SIGNAL( clicked() ),
81 this, SLOT( monthBack() ) ); 81 this, SLOT( monthBack() ) );
82 connect( next, SIGNAL( clicked() ), 82 connect( next, SIGNAL( clicked() ),
83 this, SLOT( monthForward() ) ); 83 this, SLOT( monthForward() ) );
84 back->setAutoRepeat( TRUE ); 84 back->setAutoRepeat( TRUE );
85 next->setAutoRepeat( TRUE ); 85 next->setAutoRepeat( TRUE );
86} 86}
87 87
88 88
89DateBookMonthHeader::~DateBookMonthHeader() 89DateBookMonthHeader::~DateBookMonthHeader()
90{ 90{
91 91
92} 92}
93 93
94void DateBookMonthHeader::updateDate() 94void DateBookMonthHeader::updateDate()
95{ 95{
96 emit dateChanged( year->value(), month->currentItem() + 1 ); 96 emit dateChanged( year->value(), month->currentItem() + 1 );
97} 97}
98 98
99void DateBookMonthHeader::firstMonth() 99void DateBookMonthHeader::firstMonth()
100{ 100{
101 emit dateChanged( year->value(), 1 ); 101 emit dateChanged( year->value(), 1 );
102 month->setCurrentItem( 0 ); 102 month->setCurrentItem( 0 );
103} 103}
104 104
105void DateBookMonthHeader::lastMonth() 105void DateBookMonthHeader::lastMonth()
106{ 106{
107 emit dateChanged( year->value(), 12 ); 107 emit dateChanged( year->value(), 12 );
108 month->setCurrentItem( 11 ); 108 month->setCurrentItem( 11 );
109} 109}
110 110
111void DateBookMonthHeader::monthBack() 111void DateBookMonthHeader::monthBack()
112{ 112{
113 if ( month->currentItem() > 0 ) { 113 if ( month->currentItem() > 0 ) {
114 emit dateChanged( year->value(), month->currentItem() ); 114 emit dateChanged( year->value(), month->currentItem() );
115 month->setCurrentItem( month->currentItem() - 1 ); 115 month->setCurrentItem( month->currentItem() - 1 );
116 } else { 116 } else {
117 emit dateChanged( year->value() - 1, 12 ); 117 emit dateChanged( year->value() - 1, 12 );
118 // we have a signal set to a changed value in year so we only need to change 118 // we have a signal set to a changed value in year so we only need to change
119 // year to get the result... 119 // year to get the result...
120 month->setCurrentItem( 11 ); 120 month->setCurrentItem( 11 );
121 year->setValue( year->value() - 1 ); 121 year->setValue( year->value() - 1 );
122 } 122 }
@@ -142,100 +142,100 @@ void DateBookMonthHeader::setDate( int y, int m )
142} 142}
143 143
144//--------------------------------------------------------------------------- 144//---------------------------------------------------------------------------
145 145
146class DateBookMonthTablePrivate 146class DateBookMonthTablePrivate
147{ 147{
148public: 148public:
149 DateBookMonthTablePrivate() {}; 149 DateBookMonthTablePrivate() {};
150 ~DateBookMonthTablePrivate() { mMonthEvents.clear(); }; 150 ~DateBookMonthTablePrivate() { mMonthEvents.clear(); };
151 151
152 QValueList<EffectiveEvent> mMonthEvents; 152 QValueList<EffectiveEvent> mMonthEvents;
153 bool onMonday; 153 bool onMonday;
154}; 154};
155 155
156DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name, 156DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name,
157 DateBookDB *newDb ) 157 DateBookDB *newDb )
158 : QTable( 6, 7, parent, name ), 158 : QTable( 6, 7, parent, name ),
159 db( newDb ) 159 db( newDb )
160{ 160{
161 d = new DateBookMonthTablePrivate(); 161 d = new DateBookMonthTablePrivate();
162 selYear = -1; 162 selYear = -1;
163 selMonth = -1; 163 selMonth = -1;
164 selDay = -1; 164 selDay = -1;
165 165
166 /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ 166 /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */
167 year = -1; 167 year = -1;
168 month = -1; 168 month = -1;
169 day = -1; 169 day = -1;
170 170
171 Config cfg( "qpe" ); 171 Config cfg( "qpe" );
172 cfg.setGroup( "Time" ); 172 cfg.setGroup( "Time" );
173 d->onMonday = cfg.readBoolEntry( "MONDAY" ); 173 d->onMonday = cfg.readBoolEntry( "MONDAY" );
174 174
175 horizontalHeader()->setResizeEnabled( FALSE ); 175 horizontalHeader()->setResizeEnabled( FALSE );
176 // we have to do this here... or suffer the consequences later... 176 // we have to do this here... or suffer the consequences later...
177 for ( int i = 0; i < 7; i++ ){ 177 for ( int i = 0; i < 7; i++ ){
178 horizontalHeader()->resizeSection( i, 30 ); 178 horizontalHeader()->resizeSection( i, 30 );
179 setColumnStretchable( i, TRUE ); 179 setColumnStretchable( i, TRUE );
180 } 180 }
181 setupLabels(); 181 setupLabels();
182 182
183 verticalHeader()->hide(); 183 verticalHeader()->hide();
184 setLeftMargin( 0 ); 184 setLeftMargin( 0 );
185 for ( int i = 0; i < 6; ++i ) 185 for ( int i = 0; i < 6; ++i )
186 setRowStretchable( i, TRUE ); 186 setRowStretchable( i, TRUE );
187 187
188 setSelectionMode( NoSelection ); 188 setSelectionMode( NoSelection );
189 189
190 connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ), 190 connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ),
191 this, SLOT( dayClicked( int, int ) ) ); 191 this, SLOT( dayClicked(int,int) ) );
192 connect( this, SIGNAL( currentChanged( int, int ) ), 192 connect( this, SIGNAL( currentChanged(int,int) ),
193 this, SLOT( dragDay( int, int ) ) ); 193 this, SLOT( dragDay(int,int) ) );
194 setVScrollBarMode( AlwaysOff ); 194 setVScrollBarMode( AlwaysOff );
195 setHScrollBarMode( AlwaysOff ); 195 setHScrollBarMode( AlwaysOff );
196} 196}
197 197
198DateBookMonthTable::~DateBookMonthTable() 198DateBookMonthTable::~DateBookMonthTable()
199{ 199{
200 monthsEvents.clear(); 200 monthsEvents.clear();
201 delete d; 201 delete d;
202} 202}
203 203
204void DateBookMonthTable::setDate(int y, int m, int d) 204void DateBookMonthTable::setDate(int y, int m, int d)
205{ 205{
206 if (month == m && year == y) { 206 if (month == m && year == y) {
207 if ( selYear == -1 ) 207 if ( selYear == -1 )
208 year = selYear; 208 year = selYear;
209 if ( selMonth == -1 ) 209 if ( selMonth == -1 )
210 month = selMonth; 210 month = selMonth;
211 int r1, c1, r2, c2; 211 int r1, c1, r2, c2;
212 findDay(selDay, r1, c1); 212 findDay(selDay, r1, c1);
213 selDay = day = d; 213 selDay = day = d;
214 findDay(selDay, r2, c2); 214 findDay(selDay, r2, c2);
215 setCurrentCell( r2, c2 ); 215 setCurrentCell( r2, c2 );
216 //updateCell(r1,c1); 216 //updateCell(r1,c1);
217 //updateCell(r2,c2); 217 //updateCell(r2,c2);
218 } else { 218 } else {
219 selYear = year = y; 219 selYear = year = y;
220 selMonth = month = m; 220 selMonth = month = m;
221 selDay = day = d; 221 selDay = day = d;
222 setupTable(); 222 setupTable();
223 } 223 }
224} 224}
225 225
226void DateBookMonthTable::redraw() 226void DateBookMonthTable::redraw()
227{ 227{
228 setupLabels(); 228 setupLabels();
229 setupTable(); 229 setupTable();
230} 230}
231 231
232void DateBookMonthTable::setWeekStart( bool onMonday ) 232void DateBookMonthTable::setWeekStart( bool onMonday )
233{ 233{
234 d->onMonday = onMonday; 234 d->onMonday = onMonday;
235 setupLabels(); 235 setupLabels();
236 setupTable(); 236 setupTable();
237} 237}
238 238
239void DateBookMonthTable::setupTable() 239void DateBookMonthTable::setupTable()
240{ 240{
241 QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); 241 QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday );
@@ -349,100 +349,100 @@ void DateBookMonthTable::getEvents()
349 && e.date() == (*it).date() ) { 349 && e.date() == (*it).date() ) {
350 dayEvent.append( *it ); 350 dayEvent.append( *it );
351 ++it; 351 ++it;
352 } 352 }
353 int row, col; 353 int row, col;
354 findDay( e.date().day(), row, col ); 354 findDay( e.date().day(), row, col );
355 DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) ); 355 DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) );
356 w->setEvents( dayEvent ); 356 w->setEvents( dayEvent );
357 updateCell( row, col ); 357 updateCell( row, col );
358 dayEvent.clear(); 358 dayEvent.clear();
359 } 359 }
360} 360}
361 361
362 362
363void DateBookMonthTable::setupLabels() 363void DateBookMonthTable::setupLabels()
364{ 364{
365 for ( int i = 0; i < 7; ++i ) { 365 for ( int i = 0; i < 7; ++i ) {
366 // horizontalHeader()->resizeSection( i, 30 ); 366 // horizontalHeader()->resizeSection( i, 30 );
367 // setColumnStretchable( i, TRUE ); 367 // setColumnStretchable( i, TRUE );
368 if ( d->onMonday ) 368 if ( d->onMonday )
369 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) ); 369 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) );
370 else { 370 else {
371 if ( i == 0 ) 371 if ( i == 0 )
372 horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) ); 372 horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) );
373 else 373 else
374 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) ); 374 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) );
375 } 375 }
376 } 376 }
377} 377}
378 378
379 379
380//--------------------------------------------------------------------------- 380//---------------------------------------------------------------------------
381 381
382DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac, 382DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac,
383 DateBookDB *data ) 383 DateBookDB *data )
384 : QVBox( parent, name ), 384 : QVBox( parent, name ),
385 autoClose( ac ) 385 autoClose( ac )
386{ 386{
387 setFocusPolicy(StrongFocus); 387 setFocusPolicy(StrongFocus);
388 year = QDate::currentDate().year(); 388 year = QDate::currentDate().year();
389 month = QDate::currentDate().month(); 389 month = QDate::currentDate().month();
390 day = QDate::currentDate().day(); 390 day = QDate::currentDate().day();
391 header = new DateBookMonthHeader( this, "DateBookMonthHeader" ); 391 header = new DateBookMonthHeader( this, "DateBookMonthHeader" );
392 table = new DateBookMonthTable( this, "DateBookMonthTable", data ); 392 table = new DateBookMonthTable( this, "DateBookMonthTable", data );
393 header->setDate( year, month ); 393 header->setDate( year, month );
394 table->setDate( year, month, QDate::currentDate().day() ); 394 table->setDate( year, month, QDate::currentDate().day() );
395 header->setFocusPolicy(NoFocus); 395 header->setFocusPolicy(NoFocus);
396 table->setFocusPolicy(NoFocus); 396 table->setFocusPolicy(NoFocus);
397 connect( header, SIGNAL( dateChanged( int, int ) ), 397 connect( header, SIGNAL( dateChanged(int,int) ),
398 this, SLOT( setDate( int, int ) ) ); 398 this, SLOT( setDate(int,int) ) );
399 connect( table, SIGNAL( dateClicked( int, int, int ) ), 399 connect( table, SIGNAL( dateClicked(int,int,int) ),
400 this, SLOT( finalDate(int, int, int) ) ); 400 this, SLOT( finalDate(int,int,int) ) );
401 connect( qApp, SIGNAL(weekChanged(bool)), this, 401 connect( qApp, SIGNAL(weekChanged(bool)), this,
402 SLOT(slotWeekChange(bool)) ); 402 SLOT(slotWeekChange(bool)) );
403 table->setFocus(); 403 table->setFocus();
404} 404}
405 405
406DateBookMonth::~DateBookMonth() 406DateBookMonth::~DateBookMonth()
407{ 407{
408 408
409} 409}
410 410
411void DateBookMonth::setDate( int y, int m ) 411void DateBookMonth::setDate( int y, int m )
412{ 412{
413 /* only change the date if this is a different date, 413 /* only change the date if this is a different date,
414 * other wise we may mistakenly overide the day */ 414 * other wise we may mistakenly overide the day */
415 if ( (y != year) || (m != month) ) { 415 if ( (y != year) || (m != month) ) {
416 year = y; 416 year = y;
417 month = m; 417 month = m;
418 QDate nd( y, m, 1 ); 418 QDate nd( y, m, 1 );
419 if ( nd.daysInMonth() < day ) 419 if ( nd.daysInMonth() < day )
420 day = nd.daysInMonth(); 420 day = nd.daysInMonth();
421 table->setDate( year, month, day ); 421 table->setDate( year, month, day );
422 } 422 }
423} 423}
424 424
425void DateBookMonth::setDate( int y, int m, int d ) 425void DateBookMonth::setDate( int y, int m, int d )
426{ 426{
427 header->setDate( y, m); 427 header->setDate( y, m);
428 table->setDate( y, m, d); 428 table->setDate( y, m, d);
429 year = y; 429 year = y;
430 month = m; 430 month = m;
431 day = d; 431 day = d;
432} 432}
433 433
434/* called when we wish to close or pass back the date */ 434/* called when we wish to close or pass back the date */
435void DateBookMonth::finalDate(int y, int m, int d) 435void DateBookMonth::finalDate(int y, int m, int d)
436{ 436{
437 setDate( y, m, d ); 437 setDate( y, m, d );
438 438
439 emit dateClicked(y, m, d); 439 emit dateClicked(y, m, d);
440 // emit dateClicked(QDate(y, m, d).toString()); 440 // emit dateClicked(QDate(y, m, d).toString());
441 441
442 if ( autoClose && parentWidget() ) 442 if ( autoClose && parentWidget() )
443 parentWidget()->close(); 443 parentWidget()->close();
444} 444}
445 445
446void DateBookMonth::setDate( QDate d) 446void DateBookMonth::setDate( QDate d)
447{ 447{
448 setDate(d.year(), d.month(), d.day()); 448 setDate(d.year(), d.month(), d.day());
@@ -651,100 +651,100 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg,
651 p->setFont( f ); 651 p->setFont( f );
652 QFontMetrics fm( f ); 652 QFontMetrics fm( f );
653 p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) ); 653 p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) );
654 654
655 p->restore(); 655 p->restore();
656} 656}
657 657
658 658
659 659
660void DayItemMonth::setType( Calendar::Day::Type t ) 660void DayItemMonth::setType( Calendar::Day::Type t )
661{ 661{
662 switch ( t ) { 662 switch ( t ) {
663 case Calendar::Day::PrevMonth: 663 case Calendar::Day::PrevMonth:
664 case Calendar::Day::NextMonth: 664 case Calendar::Day::NextMonth:
665 back = QBrush( QColor( 224, 224, 224 ) ); 665 back = QBrush( QColor( 224, 224, 224 ) );
666 forg = black; 666 forg = black;
667 break; 667 break;
668 case Calendar::Day::ThisMonth: 668 case Calendar::Day::ThisMonth:
669 back = QBrush( white ); 669 back = QBrush( white );
670 forg = black; 670 forg = black;
671 break; 671 break;
672 } 672 }
673 typ = t; 673 typ = t;
674} 674}
675 675
676 676
677 677
678DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) 678DateButton::DateButton( bool longDate, QWidget *parent, const char * name )
679 :QPushButton( parent, name ) 679 :QPushButton( parent, name )
680{ 680{
681 longFormat = longDate; 681 longFormat = longDate;
682 df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); 682 df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear);
683 setDate( QDate::currentDate() ); 683 setDate( QDate::currentDate() );
684 684
685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); 685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate()));
686 686
687 687
688} 688}
689 689
690 690
691void DateButton::pickDate() 691void DateButton::pickDate()
692{ 692{
693 static QPopupMenu *m1 = 0; 693 static QPopupMenu *m1 = 0;
694 static DateBookMonth *picker = 0; 694 static DateBookMonth *picker = 0;
695 if ( !m1 ) { 695 if ( !m1 ) {
696 m1 = new QPopupMenu( this ); 696 m1 = new QPopupMenu( this );
697 picker = new DateBookMonth( m1, 0, TRUE ); 697 picker = new DateBookMonth( m1, 0, TRUE );
698 m1->insertItem( picker ); 698 m1->insertItem( picker );
699 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 699 connect( picker, SIGNAL( dateClicked(int,int,int) ),
700 this, SLOT( setDate( int, int, int ) ) ); 700 this, SLOT( setDate(int,int,int) ) );
701 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 701 connect( picker, SIGNAL( dateClicked(int,int,int) ),
702 this, SIGNAL( dateSelected( int, int, int ) ) ); 702 this, SIGNAL( dateSelected(int,int,int) ) );
703 connect( m1, SIGNAL( aboutToHide() ), 703 connect( m1, SIGNAL( aboutToHide() ),
704 this, SLOT( gotHide() ) ); 704 this, SLOT( gotHide() ) );
705 } 705 }
706 picker->slotWeekChange( weekStartsMonday ); 706 picker->slotWeekChange( weekStartsMonday );
707 picker->setDate( currDate.year(), currDate.month(), currDate.day() ); 707 picker->setDate( currDate.year(), currDate.month(), currDate.day() );
708 m1->popup(mapToGlobal(QPoint(0,height()))); 708 m1->popup(mapToGlobal(QPoint(0,height())));
709 picker->setFocus(); 709 picker->setFocus();
710} 710}
711 711
712 712
713void DateButton::gotHide() 713void DateButton::gotHide()
714{ 714{
715 // we have to redo the button... 715 // we have to redo the button...
716 setDown( false ); 716 setDown( false );
717} 717}
718 718
719 719
720// void dateSelected( int year, int month, int day ); 720// void dateSelected( int year, int month, int day );
721 721
722void DateButton::setWeekStartsMonday( int b ) 722void DateButton::setWeekStartsMonday( int b )
723{ 723{
724 weekStartsMonday = b; 724 weekStartsMonday = b;
725} 725}
726 726
727void DateButton::setDate( int y, int m, int d ) 727void DateButton::setDate( int y, int m, int d )
728{ 728{
729 setDate( QDate( y,m,d) ); 729 setDate( QDate( y,m,d) );
730} 730}
731 731
732void DateButton::setDate( QDate d ) 732void DateButton::setDate( QDate d )
733{ 733{
734 currDate = d; 734 currDate = d;
735 setText( longFormat ? TimeString::longDateString( d, df ) : 735 setText( longFormat ? TimeString::longDateString( d, df ) :
736 TimeString::shortDate( d, df ) ); 736 TimeString::shortDate( d, df ) );
737 737
738} 738}
739 739
740void DateButton::setDateFormat( DateFormat f ) 740void DateButton::setDateFormat( DateFormat f )
741{ 741{
742 df = f; 742 df = f;
743 setDate( currDate ); 743 setDate( currDate );
744} 744}
745 745
746bool DateButton::customWhatsThis() const 746bool DateButton::customWhatsThis() const
747{ 747{
748 return TRUE; 748 return TRUE;
749} 749}
750 750
diff --git a/library/fileselector.cpp b/library/fileselector.cpp
index 7c29aba..93fb429 100644
--- a/library/fileselector.cpp
+++ b/library/fileselector.cpp
@@ -263,125 +263,125 @@ public:
263 \ingroup qtopiaemb 263 \ingroup qtopiaemb
264 \sa FileManager 264 \sa FileManager
265*/ 265*/
266 266
267/*! 267/*!
268 Constructs a FileSelector with mime filter \a f. 268 Constructs a FileSelector with mime filter \a f.
269 The standard Qt \a parent and \a name parameters are passed to the 269 The standard Qt \a parent and \a name parameters are passed to the
270 parent widget. 270 parent widget.
271 271
272 If \a newVisible is TRUE, the widget has a button to allow the user 272 If \a newVisible is TRUE, the widget has a button to allow the user
273 the create "new" documents; this is useful for applications that can 273 the create "new" documents; this is useful for applications that can
274 create and edit documents but not suitable for applications that 274 create and edit documents but not suitable for applications that
275 only provide viewing. 275 only provide viewing.
276 276
277 \a closeVisible is deprecated 277 \a closeVisible is deprecated
278 278
279 \sa DocLnkSet::DocLnkSet() 279 \sa DocLnkSet::DocLnkSet()
280*/ 280*/
281FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name, bool newVisible, bool closeVisible ) 281FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name, bool newVisible, bool closeVisible )
282 : QVBox( parent, name ), filter( f ) 282 : QVBox( parent, name ), filter( f )
283{ 283{
284 setMargin( 0 ); 284 setMargin( 0 );
285 setSpacing( 0 ); 285 setSpacing( 0 );
286 286
287 d = new FileSelectorPrivate(); 287 d = new FileSelectorPrivate();
288 d->newDocItem = 0; 288 d->newDocItem = 0;
289 d->showNew = newVisible; 289 d->showNew = newVisible;
290 d->catId = -2; // All files 290 d->catId = -2; // All files
291 291
292 d->toolbar = new QHBox( this ); 292 d->toolbar = new QHBox( this );
293 d->toolbar->setBackgroundMode( PaletteButton ); // same colour as toolbars 293 d->toolbar->setBackgroundMode( PaletteButton ); // same colour as toolbars
294 d->toolbar->setSpacing( 0 ); 294 d->toolbar->setSpacing( 0 );
295 d->toolbar->hide(); 295 d->toolbar->hide();
296 296
297 QWidget *spacer = new QWidget( d->toolbar ); 297 QWidget *spacer = new QWidget( d->toolbar );
298 spacer->setBackgroundMode( PaletteButton ); 298 spacer->setBackgroundMode( PaletteButton );
299 299
300 QToolButton *tb = new QToolButton( d->toolbar ); 300 QToolButton *tb = new QToolButton( d->toolbar );
301 tb->setPixmap( Resource::loadPixmap( "close" ) ); 301 tb->setPixmap( Resource::loadPixmap( "close" ) );
302 connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) ); 302 connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) );
303 buttonClose = tb; 303 buttonClose = tb;
304 tb->setFixedSize( 18, 20 ); // tb->sizeHint() ); 304 tb->setFixedSize( 18, 20 ); // tb->sizeHint() );
305 tb->setAutoRaise( TRUE ); 305 tb->setAutoRaise( TRUE );
306 QToolTip::add( tb, tr( "Close the File Selector" ) ); 306 QToolTip::add( tb, tr( "Close the File Selector" ) );
307 QPEMenuToolFocusManager::manager()->addWidget( tb ); 307 QPEMenuToolFocusManager::manager()->addWidget( tb );
308 308
309 view = new FileSelectorView( this, "fileview" ); 309 view = new FileSelectorView( this, "fileview" );
310 QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold ); 310 QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold );
311 connect( view, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), 311 connect( view, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
312 this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) ); 312 this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) );
313 connect( view, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ), 313 connect( view, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
314 this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) ); 314 this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) );
315 connect( view, SIGNAL( returnPressed( QListViewItem * ) ), 315 connect( view, SIGNAL( returnPressed(QListViewItem*) ),
316 this, SLOT( fileClicked( QListViewItem * ) ) ); 316 this, SLOT( fileClicked(QListViewItem*) ) );
317 317
318 QHBox *hb = new QHBox( this ); 318 QHBox *hb = new QHBox( this );
319 319
320 d->typeCombo = new TypeCombo( hb ); 320 d->typeCombo = new TypeCombo( hb );
321 connect( d->typeCombo, SIGNAL(selected(const QString&)), 321 connect( d->typeCombo, SIGNAL(selected(const QString&)),
322 this, SLOT(typeSelected(const QString&)) ); 322 this, SLOT(typeSelected(const QString&)) );
323 QWhatsThis::add( d->typeCombo, tr("Show documents of this type") ); 323 QWhatsThis::add( d->typeCombo, tr("Show documents of this type") );
324 324
325 Categories c; 325 Categories c;
326 c.load(categoryFileName()); 326 c.load(categoryFileName());
327 QArray<int> vl( 0 ); 327 QArray<int> vl( 0 );
328 d->catSelect = new CategorySelect( hb ); 328 d->catSelect = new CategorySelect( hb );
329 d->catSelect->setRemoveCategoryEdit( TRUE ); 329 d->catSelect->setRemoveCategoryEdit( TRUE );
330 d->catSelect->setCategories( vl, "Document View", tr("Document View") ); 330 d->catSelect->setCategories( vl, "Document View", tr("Document View") );
331 d->catSelect->setAllCategories( TRUE ); 331 d->catSelect->setAllCategories( TRUE );
332 connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) ); 332 connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) );
333 QWhatsThis::add( d->catSelect, tr("Show documents in this category") ); 333 QWhatsThis::add( d->catSelect, tr("Show documents in this category") );
334 334
335 setCloseVisible( closeVisible ); 335 setCloseVisible( closeVisible );
336 336
337 QCopChannel *channel = new QCopChannel( "QPE/Card", this ); 337 QCopChannel *channel = new QCopChannel( "QPE/Card", this );
338 connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), 338 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
339 this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); 339 this, SLOT(cardMessage(const QCString&,const QByteArray&)) );
340 340
341 reread(); 341 reread();
342 updateWhatsThis(); 342 updateWhatsThis();
343} 343}
344 344
345/*! 345/*!
346 Destroys the widget. 346 Destroys the widget.
347*/ 347*/
348FileSelector::~FileSelector() 348FileSelector::~FileSelector()
349{ 349{
350 delete d; 350 delete d;
351} 351}
352 352
353/*! 353/*!
354 Returns the number of files in the view. If this is zero, an editor 354 Returns the number of files in the view. If this is zero, an editor
355 application might bypass the selector and immediately start with 355 application might bypass the selector and immediately start with
356 a "new" document. 356 a "new" document.
357*/ 357*/
358int FileSelector::fileCount() 358int FileSelector::fileCount()
359{ 359{
360 return d->files.children().count();; 360 return d->files.children().count();;
361} 361}
362 362
363/*! 363/*!
364 Calling this function is the programmatic equivalent of the user 364 Calling this function is the programmatic equivalent of the user
365 pressing the "new" button. 365 pressing the "new" button.
366 366
367 \sa newSelected(), closeMe() 367 \sa newSelected(), closeMe()
368*/ 368*/
369void FileSelector::createNew() 369void FileSelector::createNew()
370{ 370{
371 DocLnk f; 371 DocLnk f;
372 emit newSelected( f ); 372 emit newSelected( f );
373 emit closeMe(); 373 emit closeMe();
374} 374}
375 375
376void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) 376void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int )
377{ 377{
378 if ( !i ) 378 if ( !i )
379 return; 379 return;
380 if ( button == Qt::LeftButton ) { 380 if ( button == Qt::LeftButton ) {
381 fileClicked( i ); 381 fileClicked( i );
382 } 382 }
383} 383}
384 384
385void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, int ) 385void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, int )
386{ 386{
387 if ( !i || i == d->newDocItem ) 387 if ( !i || i == d->newDocItem )
diff --git a/library/finddialog.cpp b/library/finddialog.cpp
index 64487c9..9417179 100644
--- a/library/finddialog.cpp
+++ b/library/finddialog.cpp
@@ -1,84 +1,80 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
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_FD 23#define QTOPIA_INTERNAL_FD
24 24
25#include "finddialog.h" 25#include "finddialog.h"
26#include "findwidget_p.h" 26#include "findwidget_p.h"
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29 29
30/*! 30/*!
31 \class FindDialog finddialog.h 31 \class FindDialog finddialog.h
32 \brief A simple FindDialog 32 \brief A simple FindDialog
33 33
34 A find dialog. FIXME!!!! 34 A find dialog. FIXME!!!!
35 35
36*/ 36*/
37FindDialog::FindDialog( const QString &appName, QWidget *parent, 37FindDialog::FindDialog( const QString &appName, QWidget *parent,
38 const char *name, bool modal ) 38 const char *name, bool modal )
39 : QDialog( parent, name, modal ) 39 : QDialog( parent, name, modal )
40{ 40{
41 setCaption( tr("Find") ); 41 setCaption( tr("Find") );
42 QVBoxLayout *vb; 42 QVBoxLayout *vb;
43 vb = new QVBoxLayout( this ); 43 vb = new QVBoxLayout( this );
44 fw = new FindWidget( appName, this, "Find Widget" ); 44 fw = new FindWidget( appName, this, "Find Widget" );
45 vb->addWidget( fw ); 45 vb->addWidget( fw );
46 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&, 46 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,bool,bool,int)),
47 bool,bool,int)), 47 this, SIGNAL(signalFindClicked(const QString&,bool,bool,int)) );
48 this, SIGNAL(signalFindClicked(const QString&, 48 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)),
49 bool,bool,int)) ); 49 this, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)) );
50 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&,
51 bool,bool,int)),
52 this, SIGNAL(signalFindClicked(const QString&,
53 const QDate&,bool,bool,int)) );
54 d = 0; 50 d = 0;
55} 51}
56 52
57FindDialog::~FindDialog() 53FindDialog::~FindDialog()
58{ 54{
59} 55}
60 56
61QString FindDialog::findText() const 57QString FindDialog::findText() const
62{ 58{
63 return fw->findText(); 59 return fw->findText();
64} 60}
65 61
66void FindDialog::setUseDate( bool show ) 62void FindDialog::setUseDate( bool show )
67{ 63{
68 fw->setUseDate( show ); 64 fw->setUseDate( show );
69} 65}
70 66
71void FindDialog::setDate( const QDate &dt ) 67void FindDialog::setDate( const QDate &dt )
72{ 68{
73 fw->setDate( dt ); 69 fw->setDate( dt );
74} 70}
75 71
76void FindDialog::slotNotFound() 72void FindDialog::slotNotFound()
77{ 73{
78 fw->slotNotFound(); 74 fw->slotNotFound();
79} 75}
80 76
81void FindDialog::slotWrapAround() 77void FindDialog::slotWrapAround()
82{ 78{
83 fw->slotWrapAround(); 79 fw->slotWrapAround();
84} 80}
diff --git a/library/findwidget_p.cpp b/library/findwidget_p.cpp
index e91d789..0591f07 100644
--- a/library/findwidget_p.cpp
+++ b/library/findwidget_p.cpp
@@ -2,98 +2,98 @@
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "findwidget_p.h" 21#include "findwidget_p.h"
22 22
23#include <qpe/categoryselect.h> 23#include <qpe/categoryselect.h>
24#include <qpe/datebookmonth.h> 24#include <qpe/datebookmonth.h>
25 25
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29 29
30FindWidget::FindWidget( const QString &appName, QWidget *parent, 30FindWidget::FindWidget( const QString &appName, QWidget *parent,
31 const char *name ) 31 const char *name )
32 : FindWidgetBase( parent, name ), 32 : FindWidgetBase( parent, name ),
33 mStrApp( appName ), 33 mStrApp( appName ),
34 mDate( QDate::currentDate() ) 34 mDate( QDate::currentDate() )
35{ 35{
36 setMaximumSize( sizeHint() ); 36 setMaximumSize( sizeHint() );
37 QArray<int> vl(0); 37 QArray<int> vl(0);
38 cmbCat->setCategories( vl, mStrApp ); 38 cmbCat->setCategories( vl, mStrApp );
39 cmbCat->setRemoveCategoryEdit( TRUE ); 39 cmbCat->setRemoveCategoryEdit( TRUE );
40 cmbCat->setAllCategories( TRUE ); 40 cmbCat->setAllCategories( TRUE );
41 // hide junk for the moment... 41 // hide junk for the moment...
42 lblStartDate->hide(); 42 lblStartDate->hide();
43 cmdStartDate->hide(); 43 cmdStartDate->hide();
44 QPopupMenu *m1 = new QPopupMenu( this ); 44 QPopupMenu *m1 = new QPopupMenu( this );
45 dtPicker = new DateBookMonth( m1, 0, TRUE ); 45 dtPicker = new DateBookMonth( m1, 0, TRUE );
46 dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() ); 46 dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() );
47 m1->insertItem( dtPicker ); 47 m1->insertItem( dtPicker );
48 cmdStartDate->setPopup( m1 ); 48 cmdStartDate->setPopup( m1 );
49 cmdStartDate->setText( TimeString::shortDate(mDate) ); 49 cmdStartDate->setText( TimeString::shortDate(mDate) );
50 QObject::connect( dtPicker, SIGNAL(dateClicked(int, int, int)), 50 QObject::connect( dtPicker, SIGNAL(dateClicked(int,int,int)),
51 this, SLOT(slotDateChanged(int, int, int)) ); 51 this, SLOT(slotDateChanged(int,int,int)) );
52 52
53 QObject::connect( cmdFind, SIGNAL(clicked()), 53 QObject::connect( cmdFind, SIGNAL(clicked()),
54 this, SLOT(slotFindClicked()) ); 54 this, SLOT(slotFindClicked()) );
55} 55}
56 56
57FindWidget::~FindWidget() 57FindWidget::~FindWidget()
58{ 58{
59} 59}
60 60
61QString FindWidget::findText() const 61QString FindWidget::findText() const
62{ 62{
63 return txtFind->text(); 63 return txtFind->text();
64} 64}
65 65
66void FindWidget::slotFindClicked() 66void FindWidget::slotFindClicked()
67{ 67{
68 lblStatus->setText( "" ); 68 lblStatus->setText( "" );
69 if ( cmdStartDate->isVisible() ) 69 if ( cmdStartDate->isVisible() )
70 emit signalFindClicked( findText(), 70 emit signalFindClicked( findText(),
71 mDate, 71 mDate,
72 chkCase->isChecked(), 72 chkCase->isChecked(),
73 chkBackwards->isChecked(), 73 chkBackwards->isChecked(),
74 cmbCat->currentCategory() ); 74 cmbCat->currentCategory() );
75 else 75 else
76 emit signalFindClicked( findText(), chkCase->isChecked(), 76 emit signalFindClicked( findText(), chkCase->isChecked(),
77 chkBackwards->isChecked(), 77 chkBackwards->isChecked(),
78 cmbCat->currentCategory() ); 78 cmbCat->currentCategory() );
79} 79}
80 80
81void FindWidget::setUseDate( bool show ) 81void FindWidget::setUseDate( bool show )
82{ 82{
83 if ( show ) { 83 if ( show ) {
84 lblStartDate->show(); 84 lblStartDate->show();
85 cmdStartDate->show(); 85 cmdStartDate->show();
86 } else { 86 } else {
87 lblStartDate->hide(); 87 lblStartDate->hide();
88 cmdStartDate->hide(); 88 cmdStartDate->hide();
89 } 89 }
90 chkBackwards->setDisabled( show ); 90 chkBackwards->setDisabled( show );
91} 91}
92 92
93void FindWidget::setDate( const QDate &dt ) 93void FindWidget::setDate( const QDate &dt )
94{ 94{
95 slotDateChanged( dt.year(), dt.month(), dt.day() ); 95 slotDateChanged( dt.year(), dt.month(), dt.day() );
96} 96}
97 97
98void FindWidget::slotNotFound() 98void FindWidget::slotNotFound()
99{ 99{
diff --git a/library/ir.cpp b/library/ir.cpp
index 32c0925..c581eb1 100644
--- a/library/ir.cpp
+++ b/library/ir.cpp
@@ -3,98 +3,98 @@
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "ir.h" 21#include "ir.h"
22 22
23#include "qcopenvelope_qws.h" 23#include "qcopenvelope_qws.h"
24#include "applnk.h" 24#include "applnk.h"
25 25
26/*! 26/*!
27 \class Ir ir.h 27 \class Ir ir.h
28 \brief The Ir class implements basic support for sending objects over an 28 \brief The Ir class implements basic support for sending objects over an
29 infrared communication link. 29 infrared communication link.
30 30
31 Both \link doclnk.html DocLnk\endlink objects and files can be 31 Both \link doclnk.html DocLnk\endlink objects and files can be
32 sent to another device via the infrared link using the send() 32 sent to another device via the infrared link using the send()
33 function. When the send has completed the done() signal is 33 function. When the send has completed the done() signal is
34 emitted. 34 emitted.
35 35
36 The supported() function returns whether the device supports 36 The supported() function returns whether the device supports
37 infrared communication or not. 37 infrared communication or not.
38 38
39 \ingroup qtopiaemb 39 \ingroup qtopiaemb
40*/ 40*/
41 41
42/*! 42/*!
43 Constructs an Ir object. The \a parent and \a name classes are the 43 Constructs an Ir object. The \a parent and \a name classes are the
44 standard QObject parameters. 44 standard QObject parameters.
45*/ 45*/
46Ir::Ir( QObject *parent, const char *name ) 46Ir::Ir( QObject *parent, const char *name )
47 : QObject( parent, name ) 47 : QObject( parent, name )
48{ 48{
49#ifndef QT_NO_COP 49#ifndef QT_NO_COP
50 ch = new QCopChannel( "QPE/Obex" ); 50 ch = new QCopChannel( "QPE/Obex" );
51 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), 51 connect( ch, SIGNAL(received(const QCString&,const QByteArray&)),
52 this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); 52 this, SLOT(obexMessage(const QCString&,const QByteArray&)) );
53#endif 53#endif
54} 54}
55 55
56/*! 56/*!
57 Returns TRUE if the system supports infrared communication; 57 Returns TRUE if the system supports infrared communication;
58 otherwise returns FALSE. 58 otherwise returns FALSE.
59*/ 59*/
60bool Ir::supported() 60bool Ir::supported()
61{ 61{
62#ifndef QT_NO_COP 62#ifndef QT_NO_COP
63 return QCopChannel::isRegistered( "QPE/Obex" ); 63 return QCopChannel::isRegistered( "QPE/Obex" );
64#endif 64#endif
65} 65}
66 66
67/*! 67/*!
68 Sends the object in file \a fn over the infrared link. The \a 68 Sends the object in file \a fn over the infrared link. The \a
69 description is used in the text shown to the user while sending 69 description is used in the text shown to the user while sending
70 is in progress. The optional \a mimetype parameter specifies the 70 is in progress. The optional \a mimetype parameter specifies the
71 mimetype of the object. If this parameter is not set, it is 71 mimetype of the object. If this parameter is not set, it is
72 determined by the the filename's suffix. 72 determined by the the filename's suffix.
73 73
74 \sa done() 74 \sa done()
75*/ 75*/
76void Ir::send( const QString &fn, const QString &description, const QString &mimetype) 76void Ir::send( const QString &fn, const QString &description, const QString &mimetype)
77{ 77{
78 if ( !filename.isEmpty() ) return; 78 if ( !filename.isEmpty() ) return;
79 filename = fn; 79 filename = fn;
80#ifndef QT_NO_COP 80#ifndef QT_NO_COP
81 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); 81 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
82 e << description << filename << mimetype; 82 e << description << filename << mimetype;
83#endif 83#endif
84} 84}
85 85
86/*! 86/*!
87 \overload 87 \overload
88 88
89 Uses the DocLnk::file() and DocLnk::type() of \a doc. 89 Uses the DocLnk::file() and DocLnk::type() of \a doc.
90 90
91 \sa done() 91 \sa done()
92*/ 92*/
93void Ir::send( const DocLnk &doc, const QString &description ) 93void Ir::send( const DocLnk &doc, const QString &description )
94{ 94{
95 send( doc.file(), description, doc.type() ); 95 send( doc.file(), description, doc.type() );
96} 96}
97 97
98/*! 98/*!
99 \fn Ir::done( Ir *ir ); 99 \fn Ir::done( Ir *ir );
100 100
diff --git a/library/network.cpp b/library/network.cpp
index 991e11a..df28857 100644
--- a/library/network.cpp
+++ b/library/network.cpp
@@ -116,98 +116,98 @@ void Network::connectChoiceChange(QObject* receiver, const char* slot)
116} 116}
117 117
118 #endif// QT_NO_COP 118 #endif// QT_NO_COP
119/*! 119/*!
120 \internal 120 \internal
121*/ 121*/
122QString Network::settingsDir() 122QString Network::settingsDir()
123{ 123{
124 return Global::applicationFileName("Network", "modules"); 124 return Global::applicationFileName("Network", "modules");
125} 125}
126 126
127#ifndef QT_NO_COP 127#ifndef QT_NO_COP
128/*! 128/*!
129 \internal 129 \internal
130*/ 130*/
131QStringList Network::choices(QListBox* lb, const QString& dir) 131QStringList Network::choices(QListBox* lb, const QString& dir)
132{ 132{
133 QStringList list; 133 QStringList list;
134 134
135 if ( lb ) 135 if ( lb )
136 lb->clear(); 136 lb->clear();
137 137
138 QString adir = dir.isEmpty() ? settingsDir() : dir; 138 QString adir = dir.isEmpty() ? settingsDir() : dir;
139 QDir settingsdir(adir); 139 QDir settingsdir(adir);
140 settingsdir.mkdir(adir); 140 settingsdir.mkdir(adir);
141 141
142 QStringList files = settingsdir.entryList("*.conf"); 142 QStringList files = settingsdir.entryList("*.conf");
143 for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { 143 for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) {
144 QString filename = settingsdir.filePath(*it); 144 QString filename = settingsdir.filePath(*it);
145 Config cfg(filename, Config::File); 145 Config cfg(filename, Config::File);
146 cfg.setGroup("Info"); 146 cfg.setGroup("Info");
147 if ( lb ) 147 if ( lb )
148 lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")), 148 lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")),
149 cfg.readEntry("Name")); 149 cfg.readEntry("Name"));
150 list.append(filename); 150 list.append(filename);
151 } 151 }
152 152
153 return list; 153 return list;
154} 154}
155 155
156class NetworkServer : public QCopChannel { 156class NetworkServer : public QCopChannel {
157 Q_OBJECT 157 Q_OBJECT
158public: 158public:
159 NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0) 159 NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0)
160 { 160 {
161 up = FALSE; 161 up = FALSE;
162 examineNetworks( TRUE ); 162 examineNetworks( TRUE );
163 QCopChannel* card = new QCopChannel("QPE/Card",parent); 163 QCopChannel* card = new QCopChannel("QPE/Card",parent);
164 connect(card,SIGNAL(received(const QCString &, const QByteArray&)), 164 connect(card,SIGNAL(received(const QCString&,const QByteArray&)),
165 this,SLOT(cardMessage(const QCString &, const QByteArray&))); 165 this,SLOT(cardMessage(const QCString&,const QByteArray&)));
166 } 166 }
167 167
168 ~NetworkServer() 168 ~NetworkServer()
169 { 169 {
170 stop(); 170 stop();
171 } 171 }
172 172
173 bool networkOnline() const 173 bool networkOnline() const
174 { 174 {
175 return up; 175 return up;
176 } 176 }
177 177
178private: 178private:
179 void receive(const QCString &msg, const QByteArray& data) 179 void receive(const QCString &msg, const QByteArray& data)
180 { 180 {
181 if ( msg == "start(QString,QString)" ) { 181 if ( msg == "start(QString,QString)" ) {
182 QDataStream stream(data,IO_ReadOnly); 182 QDataStream stream(data,IO_ReadOnly);
183 QString file,password; 183 QString file,password;
184 stream >> file >> password; 184 stream >> file >> password;
185 if ( file.isEmpty() ) { 185 if ( file.isEmpty() ) {
186 QStringList l = Network::choices(); 186 QStringList l = Network::choices();
187 for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) { 187 for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) {
188 Config cfg(*i,Config::File); 188 Config cfg(*i,Config::File);
189 cfg.setGroup("Info"); 189 cfg.setGroup("Info");
190 QString type = cfg.readEntry("Type"); 190 QString type = cfg.readEntry("Type");
191 NetworkInterface* plugin = Network::loadPlugin(type); 191 NetworkInterface* plugin = Network::loadPlugin(type);
192 cfg.setGroup("Properties"); 192 cfg.setGroup("Properties");
193 if ( plugin && plugin->isAvailable(cfg) ) { 193 if ( plugin && plugin->isAvailable(cfg) ) {
194 file = *i; 194 file = *i;
195 break; 195 break;
196 } 196 }
197 } 197 }
198 if ( file.isEmpty() ) { 198 if ( file.isEmpty() ) {
199 QCopEnvelope("QPE/Network", "failed()"); 199 QCopEnvelope("QPE/Network", "failed()");
200 return; 200 return;
201 } 201 }
202 } 202 }
203 start(file,password); 203 start(file,password);
204 } else if ( msg == "stop()" ) { 204 } else if ( msg == "stop()" ) {
205 stop(); 205 stop();
206 } else if ( msg == "choicesChanged()" ) { 206 } else if ( msg == "choicesChanged()" ) {
207 examineNetworks(); 207 examineNetworks();
208 } 208 }
209 } 209 }
210 210
211private slots: 211private slots:
212 void cardMessage(const QCString &msg, const QByteArray&) 212 void cardMessage(const QCString &msg, const QByteArray&)
213 { 213 {
diff --git a/library/qcopenvelope_qws.cpp b/library/qcopenvelope_qws.cpp
index 8f58787..63efb13 100644
--- a/library/qcopenvelope_qws.cpp
+++ b/library/qcopenvelope_qws.cpp
@@ -23,98 +23,98 @@
23#endif 23#endif
24#include <qbuffer.h> 24#include <qbuffer.h>
25#include <qfile.h> 25#include <qfile.h>
26#include <unistd.h> 26#include <unistd.h>
27#include <errno.h> 27#include <errno.h>
28#include <sys/file.h> 28#include <sys/file.h>
29#include <sys/types.h> 29#include <sys/types.h>
30#include <sys/stat.h> 30#include <sys/stat.h>
31#include <time.h> 31#include <time.h>
32 32
33#ifndef QT_NO_COP 33#ifndef QT_NO_COP
34 34
35/*! 35/*!
36 \class QCopEnvelope qcopenvelope_qws.h 36 \class QCopEnvelope qcopenvelope_qws.h
37 \brief The QCopEnvelope class encapsulates and sends QCop messages 37 \brief The QCopEnvelope class encapsulates and sends QCop messages
38 over QCopChannels. 38 over QCopChannels.
39 39
40 QCop messages allow applications to communicate with each other. 40 QCop messages allow applications to communicate with each other.
41 These messages are sent using QCopEnvelope, and received by connecting 41 These messages are sent using QCopEnvelope, and received by connecting
42 to a QCopChannel. 42 to a QCopChannel.
43 43
44 To send a message, use the following protocol: 44 To send a message, use the following protocol:
45 45
46 \code 46 \code
47 QCopEnvelope e(channelname, messagename); 47 QCopEnvelope e(channelname, messagename);
48 e << parameter1 << parameter2 << ...; 48 e << parameter1 << parameter2 << ...;
49 \endcode 49 \endcode
50 50
51 For messages without parameters, simply use: 51 For messages without parameters, simply use:
52 52
53 \code 53 \code
54 QCopEnvelope e(channelname, messagename); 54 QCopEnvelope e(channelname, messagename);
55 \endcode 55 \endcode
56 56
57 (Do not try to simplify this further as it may confuse some 57 (Do not try to simplify this further as it may confuse some
58 compilers.) 58 compilers.)
59 59
60 The \c{channelname} of channels within Qtopia all start with "QPE/". 60 The \c{channelname} of channels within Qtopia all start with "QPE/".
61 The \c{messagename} is a function identifier followed by a list of types 61 The \c{messagename} is a function identifier followed by a list of types
62 in parentheses. There is no whitespace in the message name. 62 in parentheses. There is no whitespace in the message name.
63 63
64 To receive a message, you will generally just use your application's 64 To receive a message, you will generally just use your application's
65 predefined QPE/Application/\e{appname} channel 65 predefined QPE/Application/\e{appname} channel
66 (see QPEApplication::appMessage()), but you can make another channel 66 (see QPEApplication::appMessage()), but you can make another channel
67 and connect it to a slot like this: 67 and connect it to a slot like this:
68 68
69 \code 69 \code
70 myChannel = new QCopChannel( "QPE/FooBar", this ); 70 myChannel = new QCopChannel( "QPE/FooBar", this );
71 connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)), 71 connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)),
72 this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) ); 72 this, SLOT(fooBarMessage(const QCString&,const QByteArray&)) );
73 \endcode 73 \endcode
74 74
75 See also, the \link qcop.html list of Qtopia messages\endlink. 75 See also, the \link qcop.html list of Qtopia messages\endlink.
76*/ 76*/
77 77
78/*! 78/*!
79 Constructs a QCopEnvelope that will write \a message to \a channel. 79 Constructs a QCopEnvelope that will write \a message to \a channel.
80 If \a message has parameters, you must then use operator<<() to 80 If \a message has parameters, you must then use operator<<() to
81 add these parameters to the envelope. 81 add these parameters to the envelope.
82*/ 82*/
83QCopEnvelope::QCopEnvelope( const QCString& channel, const QCString& message ) : 83QCopEnvelope::QCopEnvelope( const QCString& channel, const QCString& message ) :
84 QDataStream(new QBuffer), 84 QDataStream(new QBuffer),
85 ch(channel), msg(message) 85 ch(channel), msg(message)
86{ 86{
87 device()->open(IO_WriteOnly); 87 device()->open(IO_WriteOnly);
88} 88}
89 89
90/*! 90/*!
91 Writes the message and then destroys the QCopEnvelope. 91 Writes the message and then destroys the QCopEnvelope.
92*/ 92*/
93QCopEnvelope::~QCopEnvelope() 93QCopEnvelope::~QCopEnvelope()
94{ 94{
95 QByteArray data = ((QBuffer*)device())->buffer(); 95 QByteArray data = ((QBuffer*)device())->buffer();
96 const int pref=16; 96 const int pref=16;
97 if ( qstrncmp(ch.data(),"QPE/Application/",pref)==0 ) { 97 if ( qstrncmp(ch.data(),"QPE/Application/",pref)==0 ) {
98 QString qcopfn("/tmp/qcop-msg-"); 98 QString qcopfn("/tmp/qcop-msg-");
99 qcopfn += ch.mid(pref); 99 qcopfn += ch.mid(pref);
100 QFile qcopfile(qcopfn); 100 QFile qcopfile(qcopfn);
101 101
102 if ( qcopfile.open(IO_WriteOnly | IO_Append) ) { 102 if ( qcopfile.open(IO_WriteOnly | IO_Append) ) {
103#ifndef Q_OS_WIN32 103#ifndef Q_OS_WIN32
104 if(flock(qcopfile.handle(), LOCK_EX)) { 104 if(flock(qcopfile.handle(), LOCK_EX)) {
105 /* some error occurred */ 105 /* some error occurred */
106 qWarning(QString("Failed to obtain file lock on %1 (%2)") 106 qWarning(QString("Failed to obtain file lock on %1 (%2)")
107 .arg(qcopfn).arg( errno )); 107 .arg(qcopfn).arg( errno ));
108 } 108 }
109#endif 109#endif
110 { 110 {
111 QDataStream ds(&qcopfile); 111 QDataStream ds(&qcopfile);
112 ds << ch << msg << data; 112 ds << ch << msg << data;
113 qcopfile.flush(); 113 qcopfile.flush();
114#ifndef Q_OS_WIN32 114#ifndef Q_OS_WIN32
115 flock(qcopfile.handle(), LOCK_UN); 115 flock(qcopfile.handle(), LOCK_UN);
116#endif 116#endif
117 qcopfile.close(); 117 qcopfile.close();
118 } 118 }
119 119
120 QByteArray b; 120 QByteArray b;
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 262221e..c339a78 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -583,120 +583,120 @@ void QPEApplication::processQCopFile()
583\endcode 583\endcode
584 584
585 \sa qcop.html 585 \sa qcop.html
586 Note that messages received here may be processed by qpe application 586 Note that messages received here may be processed by qpe application
587 and emitted as signals, such as flush() and reload(). 587 and emitted as signals, such as flush() and reload().
588*/ 588*/
589 589
590/*! 590/*!
591 Constructs a QPEApplication just as you would construct 591 Constructs a QPEApplication just as you would construct
592 a QApplication, passing \a argc, \a argv, and \a t. 592 a QApplication, passing \a argc, \a argv, and \a t.
593 593
594 For applications, \a t should be the default, GuiClient. Only 594 For applications, \a t should be the default, GuiClient. Only
595 the Qtopia server passes GuiServer. 595 the Qtopia server passes GuiServer.
596*/ 596*/
597QPEApplication::QPEApplication( int & argc, char **argv, Type t ) 597QPEApplication::QPEApplication( int & argc, char **argv, Type t )
598 : QApplication( hack(argc), argv, t ), pidChannel( 0 ) 598 : QApplication( hack(argc), argv, t ), pidChannel( 0 )
599{ 599{
600 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. 600 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices.
601 601
602 d = new QPEApplicationData; 602 d = new QPEApplicationData;
603 d->loadTextCodecs(); 603 d->loadTextCodecs();
604 d->loadImageCodecs(); 604 d->loadImageCodecs();
605 int dw = desktop() ->width(); 605 int dw = desktop() ->width();
606 606
607 if ( dw < 200 ) { 607 if ( dw < 200 ) {
608 setFont( QFont( "vera", 8 ) ); 608 setFont( QFont( "vera", 8 ) );
609 AppLnk::setSmallIconSize( 10 ); 609 AppLnk::setSmallIconSize( 10 );
610 AppLnk::setBigIconSize( 28 ); 610 AppLnk::setBigIconSize( 28 );
611 } 611 }
612#if defined(OPIE_HIGH_RES_SMALL_PHY) 612#if defined(OPIE_HIGH_RES_SMALL_PHY)
613 else if ( dw > 600 ) { 613 else if ( dw > 600 ) {
614 setFont( QFont( "vera", 16 ) ); 614 setFont( QFont( "vera", 16 ) );
615 AppLnk::setSmallIconSize( 24 ); 615 AppLnk::setSmallIconSize( 24 );
616 AppLnk::setBigIconSize( 48 ); 616 AppLnk::setBigIconSize( 48 );
617 } 617 }
618#endif 618#endif
619 else if ( dw > 200 ) { 619 else if ( dw > 200 ) {
620 setFont( QFont( "vera", 10 ) ); 620 setFont( QFont( "vera", 10 ) );
621 AppLnk::setSmallIconSize( 14 ); 621 AppLnk::setSmallIconSize( 14 );
622 AppLnk::setBigIconSize( 32 ); 622 AppLnk::setBigIconSize( 32 );
623 } 623 }
624 624
625 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 625 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
626 626
627 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); 627 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) );
628 628
629 629
630 sysChannel = new QCopChannel( "QPE/System", this ); 630 sysChannel = new QCopChannel( "QPE/System", this );
631 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 631 connect( sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
632 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); 632 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
633 633
634/* COde now in initapp */ 634/* COde now in initapp */
635#if 0 635#if 0
636#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 636#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
637 637
638 QString qcopfn( "/tmp/qcop-msg-" ); 638 QString qcopfn( "/tmp/qcop-msg-" );
639 qcopfn += QString( argv[ 0 ] ); // append command name 639 qcopfn += QString( argv[ 0 ] ); // append command name
640 640
641 QFile f( qcopfn ); 641 QFile f( qcopfn );
642 if ( f.open( IO_ReadOnly ) ) { 642 if ( f.open( IO_ReadOnly ) ) {
643 flock( f.handle(), LOCK_EX ); 643 flock( f.handle(), LOCK_EX );
644 } 644 }
645 645
646 646
647 647
648 QCString channel = QCString( argv[ 0 ] ); 648 QCString channel = QCString( argv[ 0 ] );
649 channel.replace( QRegExp( ".*/" ), "" ); 649 channel.replace( QRegExp( ".*/" ), "" );
650 d->appName = channel; 650 d->appName = channel;
651 channel = "QPE/Application/" + channel; 651 channel = "QPE/Application/" + channel;
652 pidChannel = new QCopChannel( channel, this ); 652 pidChannel = new QCopChannel( channel, this );
653 connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 653 connect( pidChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
654 this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); 654 this, SLOT( pidMessage(const QCString&,const QByteArray&) ) );
655 655
656 if ( f.isOpen() ) { 656 if ( f.isOpen() ) {
657 d->keep_running = FALSE; 657 d->keep_running = FALSE;
658 QDataStream ds( &f ); 658 QDataStream ds( &f );
659 QCString channel, message; 659 QCString channel, message;
660 QByteArray data; 660 QByteArray data;
661 while ( !ds.atEnd() ) { 661 while ( !ds.atEnd() ) {
662 ds >> channel >> message >> data; 662 ds >> channel >> message >> data;
663 d->enqueueQCop( channel, message, data ); 663 d->enqueueQCop( channel, message, data );
664 } 664 }
665 665
666 flock( f.handle(), LOCK_UN ); 666 flock( f.handle(), LOCK_UN );
667 f.close(); 667 f.close();
668 f.remove(); 668 f.remove();
669 } 669 }
670 670
671 for ( int a = 0; a < argc; a++ ) { 671 for ( int a = 0; a < argc; a++ ) {
672 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { 672 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) {
673 argv[ a ] = argv[ a + 1 ]; 673 argv[ a ] = argv[ a + 1 ];
674 a++; 674 a++;
675 d->preloaded = TRUE; 675 d->preloaded = TRUE;
676 argc -= 1; 676 argc -= 1;
677 } 677 }
678 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { 678 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) {
679 argv[ a ] = argv[ a + 1 ]; 679 argv[ a ] = argv[ a + 1 ];
680 a++; 680 a++;
681 d->preloaded = TRUE; 681 d->preloaded = TRUE;
682 d->forceshow = TRUE; 682 d->forceshow = TRUE;
683 argc -= 1; 683 argc -= 1;
684 } 684 }
685 } 685 }
686 686
687 /* overide stored arguments */ 687 /* overide stored arguments */
688 setArgs( argc, argv ); 688 setArgs( argc, argv );
689 689
690#endif 690#endif
691#else 691#else
692 initApp( argc, argv ); 692 initApp( argc, argv );
693#endif 693#endif
694 // qwsSetDecoration( new QPEDecoration() ); 694 // qwsSetDecoration( new QPEDecoration() );
695 695
696#ifndef QT_NO_TRANSLATION 696#ifndef QT_NO_TRANSLATION
697 697
698 d->langs = Global::languageList(); 698 d->langs = Global::languageList();
699 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { 699 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) {
700 QString lang = *it; 700 QString lang = *it;
701 701
702 installTranslation( lang + "/libopie.qm"); 702 installTranslation( lang + "/libopie.qm");
@@ -706,98 +706,98 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
706 706
707 //###language/font hack; should look it up somewhere 707 //###language/font hack; should look it up somewhere
708#ifdef QWS 708#ifdef QWS
709 709
710 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 710 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
711 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 711 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
712 setFont( fn ); 712 setFont( fn );
713 } 713 }
714#endif 714#endif
715 } 715 }
716#endif 716#endif
717 717
718 applyStyle(); 718 applyStyle();
719 719
720 if ( type() == GuiServer ) { 720 if ( type() == GuiServer ) {
721 setVolume(); 721 setVolume();
722 } 722 }
723 723
724 installEventFilter( this ); 724 installEventFilter( this );
725 725
726 QPEMenuToolFocusManager::initialize(); 726 QPEMenuToolFocusManager::initialize();
727 727
728#ifdef QT_NO_QWS_CURSOR 728#ifdef QT_NO_QWS_CURSOR
729 // if we have no cursor, probably don't want tooltips 729 // if we have no cursor, probably don't want tooltips
730 QToolTip::setEnabled( FALSE ); 730 QToolTip::setEnabled( FALSE );
731#endif 731#endif
732} 732}
733 733
734 734
735#ifdef QTOPIA_INTERNAL_INITAPP 735#ifdef QTOPIA_INTERNAL_INITAPP
736void QPEApplication::initApp( int argc, char **argv ) 736void QPEApplication::initApp( int argc, char **argv )
737{ 737{
738 delete pidChannel; 738 delete pidChannel;
739 d->keep_running = TRUE; 739 d->keep_running = TRUE;
740 d->preloaded = FALSE; 740 d->preloaded = FALSE;
741 d->forceshow = FALSE; 741 d->forceshow = FALSE;
742 742
743 QCString channel = QCString(argv[0]); 743 QCString channel = QCString(argv[0]);
744 744
745 channel.replace(QRegExp(".*/"),""); 745 channel.replace(QRegExp(".*/"),"");
746 d->appName = channel; 746 d->appName = channel;
747 747
748 #if QT_VERSION > 235 748 #if QT_VERSION > 235
749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6
750 #endif 750 #endif
751 751
752 channel = "QPE/Application/" + channel; 752 channel = "QPE/Application/" + channel;
753 pidChannel = new QCopChannel( channel, this); 753 pidChannel = new QCopChannel( channel, this);
754 connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), 754 connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)),
755 this, SLOT(pidMessage(const QCString &, const QByteArray &))); 755 this, SLOT(pidMessage(const QCString&,const QByteArray&)));
756 756
757 757
758 758
759 processQCopFile(); 759 processQCopFile();
760 d->keep_running = d->qcopq.isEmpty(); 760 d->keep_running = d->qcopq.isEmpty();
761 761
762 for (int a=0; a<argc; a++) { 762 for (int a=0; a<argc; a++) {
763 if ( qstrcmp(argv[a],"-preload")==0 ) { 763 if ( qstrcmp(argv[a],"-preload")==0 ) {
764 argv[a] = argv[a+1]; 764 argv[a] = argv[a+1];
765 a++; 765 a++;
766 d->preloaded = TRUE; 766 d->preloaded = TRUE;
767 argc-=1; 767 argc-=1;
768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { 768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) {
769 argv[a] = argv[a+1]; 769 argv[a] = argv[a+1];
770 a++; 770 a++;
771 d->preloaded = TRUE; 771 d->preloaded = TRUE;
772 d->forceshow = TRUE; 772 d->forceshow = TRUE;
773 argc-=1; 773 argc-=1;
774 } 774 }
775 } 775 }
776 776
777 /* overide stored arguments */ 777 /* overide stored arguments */
778 setArgs(argc, argv); 778 setArgs(argc, argv);
779 779
780 /* install translation here */ 780 /* install translation here */
781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) 781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
782 installTranslation( (*it) + "/" + d->appName + ".qm" ); 782 installTranslation( (*it) + "/" + d->appName + ".qm" );
783} 783}
784#endif 784#endif
785 785
786 786
787static QPtrDict<void>* inputMethodDict = 0; 787static QPtrDict<void>* inputMethodDict = 0;
788static void createInputMethodDict() 788static void createInputMethodDict()
789{ 789{
790 if ( !inputMethodDict ) 790 if ( !inputMethodDict )
791 inputMethodDict = new QPtrDict<void>; 791 inputMethodDict = new QPtrDict<void>;
792} 792}
793 793
794/*! 794/*!
795 Returns the currently set hint to the system as to whether 795 Returns the currently set hint to the system as to whether
796 widget \a w has any use for text input methods. 796 widget \a w has any use for text input methods.
797 797
798 798
799 \sa setInputMethodHint() InputMethodHint 799 \sa setInputMethodHint() InputMethodHint
800*/ 800*/
801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) 801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w )
802{ 802{
803 if ( inputMethodDict && w ) 803 if ( inputMethodDict && w )
diff --git a/library/qpedialog.cpp b/library/qpedialog.cpp
index ac42972..da461b7 100644
--- a/library/qpedialog.cpp
+++ b/library/qpedialog.cpp
@@ -4,71 +4,71 @@
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define protected public 21#define protected public
22#include <qdialog.h> 22#include <qdialog.h>
23#undef protected 23#undef protected
24 24
25#include "qpedialog.h" 25#include "qpedialog.h"
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27 27
28 28
29/** 29/**
30 * \brief This is the only c'tor. 30 * \brief This is the only c'tor.
31 * 31 *
32 * The parent of this Listener is the Dialog you pass. This means once 32 * The parent of this Listener is the Dialog you pass. This means once
33 * the dialog is deleted this listener will be deleted too. 33 * the dialog is deleted this listener will be deleted too.
34 * This Listener listens on QPEApplication::appMessage signal and implements 34 * This Listener listens on QPEApplication::appMessage signal and implements
35 * accept() and reject(). 35 * accept() and reject().
36 * 36 *
37 * \code 37 * \code
38 *QDialog *dialog = new YourDialog(); 38 *QDialog *dialog = new YourDialog();
39 (void)new QPEDialogListener(dialog); 39 (void)new QPEDialogListener(dialog);
40 if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ 40 if( QPEApplication::execDialog(dialog) == QDialog::Accept ){
41 // do some stuff 41 // do some stuff
42 } 42 }
43 delete dialog; 43 delete dialog;
44 44
45 * \endcode 45 * \endcode
46 * 46 *
47 * @param di The dialog to handle 47 * @param di The dialog to handle
48 */ 48 */
49QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) 49QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di)
50{ 50{
51 dialog = di; 51 dialog = di;
52 connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 52 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
53 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 53 this, SLOT(appMessage(const QCString&,const QByteArray&)) );
54} 54}
55 55
56 56
57/** 57/**
58 * d'tor 58 * d'tor
59 */ 59 */
60QPEDialogListener::~QPEDialogListener() {} 60QPEDialogListener::~QPEDialogListener() {}
61 61
62/** 62/**
63 * \internal 63 * \internal
64 */ 64 */
65void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) 65void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & )
66{ 66{
67 if (!dialog) 67 if (!dialog)
68 return; 68 return;
69 if (msg == "accept()") { 69 if (msg == "accept()") {
70 dialog->accept(); 70 dialog->accept();
71 } else if (msg == "reject()") { 71 } else if (msg == "reject()") {
72 dialog->reject(); 72 dialog->reject();
73 } 73 }
74} 74}
diff --git a/library/storage.cpp b/library/storage.cpp
index 0ea465b..fcee689 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -50,98 +50,98 @@ static bool isCF(const QString& m)
50 50
51#ifndef Q_OS_MACX 51#ifndef Q_OS_MACX
52 FILE* f = fopen("/var/run/stab", "r"); 52 FILE* f = fopen("/var/run/stab", "r");
53 if (!f) f = fopen("/var/state/pcmcia/stab", "r"); 53 if (!f) f = fopen("/var/state/pcmcia/stab", "r");
54 if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); 54 if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
55 if ( f ) 55 if ( f )
56 { 56 {
57 char line[1024]; 57 char line[1024];
58 char devtype[80]; 58 char devtype[80];
59 char devname[80]; 59 char devname[80];
60 while ( fgets( line, 1024, f ) ) 60 while ( fgets( line, 1024, f ) )
61 { 61 {
62 // 0 ide ide-cs 0 hda 3 0 62 // 0 ide ide-cs 0 hda 3 0
63 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) 63 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 )
64 { 64 {
65 if ( QString(devtype) == "ide" && m.find(devname)>0 ) 65 if ( QString(devtype) == "ide" && m.find(devname)>0 )
66 { 66 {
67 fclose(f); 67 fclose(f);
68 return TRUE; 68 return TRUE;
69 } 69 }
70 } 70 }
71 } 71 }
72 fclose(f); 72 fclose(f);
73 } 73 }
74#endif /* Q_OS_MACX */ 74#endif /* Q_OS_MACX */
75 return FALSE; 75 return FALSE;
76} 76}
77 77
78/*! \class StorageInfo storage.h 78/*! \class StorageInfo storage.h
79 \brief The StorageInfo class describes the disks mounted on the file system. 79 \brief The StorageInfo class describes the disks mounted on the file system.
80 80
81 This class provides access to the mount information for the Linux 81 This class provides access to the mount information for the Linux
82 filesystem. Each mount point is represented by the FileSystem class. 82 filesystem. Each mount point is represented by the FileSystem class.
83 To ensure this class has the most up to date size information, call 83 To ensure this class has the most up to date size information, call
84 the update() method. Note that this will automatically be signaled 84 the update() method. Note that this will automatically be signaled
85 by the operating system when a disk has been mounted or unmounted. 85 by the operating system when a disk has been mounted or unmounted.
86 86
87 \ingroup qtopiaemb 87 \ingroup qtopiaemb
88*/ 88*/
89 89
90/*! Constructor that determines the current mount points of the filesystem. 90/*! Constructor that determines the current mount points of the filesystem.
91 The standard \a parent parameters is passed on to QObject. 91 The standard \a parent parameters is passed on to QObject.
92 */ 92 */
93StorageInfo::StorageInfo( QObject *parent ) 93StorageInfo::StorageInfo( QObject *parent )
94 : QObject( parent ) 94 : QObject( parent )
95{ 95{
96 mFileSystems.setAutoDelete( TRUE ); 96 mFileSystems.setAutoDelete( TRUE );
97 channel = new QCopChannel( "QPE/Card", this ); 97 channel = new QCopChannel( "QPE/Card", this );
98 connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), 98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); 99 this, SLOT(cardMessage(const QCString&,const QByteArray&)) );
100 update(); 100 update();
101} 101}
102 102
103/*! Returns the longest matching FileSystem that starts with the 103/*! Returns the longest matching FileSystem that starts with the
104 same prefix as \a filename as its mount point. 104 same prefix as \a filename as its mount point.
105*/ 105*/
106const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) 106const FileSystem *StorageInfo::fileSystemOf( const QString &filename )
107{ 107{
108 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) 108 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
109 { 109 {
110 if ( filename.startsWith( (*i)->path() ) ) 110 if ( filename.startsWith( (*i)->path() ) )
111 return (*i); 111 return (*i);
112 } 112 }
113 return 0; 113 return 0;
114} 114}
115 115
116 116
117void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) 117void StorageInfo::cardMessage( const QCString& msg, const QByteArray& )
118{ 118{
119 if ( msg == "mtabChanged()" ) 119 if ( msg == "mtabChanged()" )
120 update(); 120 update();
121} 121}
122 122
123 123
124/*! Updates the mount and free space available information for each mount 124/*! Updates the mount and free space available information for each mount
125 point. This method is automatically called when a disk is mounted or 125 point. This method is automatically called when a disk is mounted or
126 unmounted. 126 unmounted.
127*/ 127*/
128// cause of the lack of a d pointer we need 128// cause of the lack of a d pointer we need
129// to store informations in a config file :( 129// to store informations in a config file :(
130void StorageInfo::update() 130void StorageInfo::update()
131{ 131{
132 //qDebug("StorageInfo::updating"); 132 //qDebug("StorageInfo::updating");
133#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 133#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
134 struct mntent *me; 134 struct mntent *me;
135 FILE *mntfp = setmntent( "/etc/mtab", "r" ); 135 FILE *mntfp = setmntent( "/etc/mtab", "r" );
136 136
137 QStringList curdisks; 137 QStringList curdisks;
138 QStringList curopts; 138 QStringList curopts;
139 QStringList curfs; 139 QStringList curfs;
140 bool rebuild = FALSE; 140 bool rebuild = FALSE;
141 int n=0; 141 int n=0;
142 if ( mntfp ) 142 if ( mntfp )
143 { 143 {
144 while ( (me = getmntent( mntfp )) != 0 ) 144 while ( (me = getmntent( mntfp )) != 0 )
145 { 145 {
146 QString fs = me->mnt_fsname; 146 QString fs = me->mnt_fsname;
147 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" 147 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
diff --git a/library/timestring.cpp b/library/timestring.cpp
index 2fd0191..91c29ae 100644
--- a/library/timestring.cpp
+++ b/library/timestring.cpp
@@ -8,97 +8,97 @@
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "timestring.h" 21#include "timestring.h"
22#include <qobject.h> 22#include <qobject.h>
23#include <qpe/qpeapplication.h> //for qApp 23#include <qpe/qpeapplication.h> //for qApp
24#include "config.h" 24#include "config.h"
25 25
26 26
27class TimeStringFormatKeeper : public QObject 27class TimeStringFormatKeeper : public QObject
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30public: 30public:
31 static DateFormat currentFormat() 31 static DateFormat currentFormat()
32 { 32 {
33 if ( !self ) 33 if ( !self )
34 self = new TimeStringFormatKeeper; 34 self = new TimeStringFormatKeeper;
35 return self->format; 35 return self->format;
36 } 36 }
37private slots: 37private slots:
38 void formatChanged( DateFormat f ) 38 void formatChanged( DateFormat f )
39 { 39 {
40 format = f; 40 format = f;
41 } 41 }
42private: 42private:
43 static TimeStringFormatKeeper *self; 43 static TimeStringFormatKeeper *self;
44 DateFormat format; 44 DateFormat format;
45 45
46 TimeStringFormatKeeper() 46 TimeStringFormatKeeper()
47 : QObject( qApp ) 47 : QObject( qApp )
48 { 48 {
49 Config config("qpe"); 49 Config config("qpe");
50 config.setGroup( "Date" ); 50 config.setGroup( "Date" );
51 format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), 51 format = DateFormat(QChar(config.readEntry("Separator", "/")[0]),
52 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), 52 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear),
53 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); 53 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear));
54 54
55 connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), 55 connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ),
56 this, SLOT( formatChanged( DateFormat ) ) ); 56 this, SLOT( formatChanged(DateFormat) ) );
57 } 57 }
58}; 58};
59 59
60TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; 60TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0;
61 61
62QString DateFormat::toNumberString() const 62QString DateFormat::toNumberString() const
63{ 63{
64 QString buf = ""; 64 QString buf = "";
65 // for each part of the order 65 // for each part of the order
66 for (int i = 0; i < 3; i++) { 66 for (int i = 0; i < 3; i++) {
67 // switch on the relavent 3 bits. 67 // switch on the relavent 3 bits.
68 switch((_shortOrder >> (i * 3)) & 0x0007) { 68 switch((_shortOrder >> (i * 3)) & 0x0007) {
69 case 0x0001: 69 case 0x0001:
70 buf += QObject::tr( "D" , "Shortcut for Day"); 70 buf += QObject::tr( "D" , "Shortcut for Day");
71 break; 71 break;
72 case 0x0002: 72 case 0x0002:
73 buf += QObject::tr( "M", "Shortcur for Month" ); 73 buf += QObject::tr( "M", "Shortcur for Month" );
74 break; 74 break;
75 case 0x0004: 75 case 0x0004:
76 buf += QObject::tr( "Y" ); 76 buf += QObject::tr( "Y" );
77 break; 77 break;
78 } 78 }
79 if (i < 2) 79 if (i < 2)
80 buf += _shortSeparator; 80 buf += _shortSeparator;
81 } 81 }
82 return buf; 82 return buf;
83} 83}
84 84
85QString DateFormat::toWordString() const 85QString DateFormat::toWordString() const
86{ 86{
87 QString buf = ""; 87 QString buf = "";
88 // for each part of the order 88 // for each part of the order
89 for (int i = 0; i < 3; i++) { 89 for (int i = 0; i < 3; i++) {
90 // switch on the relavent 3 bits. 90 // switch on the relavent 3 bits.
91 switch((_longOrder >> (i * 3)) & 0x0007) { 91 switch((_longOrder >> (i * 3)) & 0x0007) {
92 case 0x0001: 92 case 0x0001:
93 buf += QObject::tr( "day" ); 93 buf += QObject::tr( "day" );
94 if (i < 2) { 94 if (i < 2) {
95 if ((_shortOrder << ((i+1) * 3)) & 0x0007) 95 if ((_shortOrder << ((i+1) * 3)) & 0x0007)
96 buf += ", "; 96 buf += ", ";
97 else 97 else
98 buf += " "; 98 buf += " ";
99 } 99 }
100 break; 100 break;
101 case 0x0002: 101 case 0x0002:
102 buf += QObject::tr( "month" ); 102 buf += QObject::tr( "month" );
103 if (i < 2) 103 if (i < 2)
104 buf += " "; 104 buf += " ";
diff --git a/library/tzselect.cpp b/library/tzselect.cpp
index f28100b..848dfb7 100644
--- a/library/tzselect.cpp
+++ b/library/tzselect.cpp
@@ -32,98 +32,98 @@
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33 33
34/*! 34/*!
35 \class TimeZoneSelector 35 \class TimeZoneSelector
36 36
37 \brief The TimeZoneSelector widget allows users to configure their time zone information. 37 \brief The TimeZoneSelector widget allows users to configure their time zone information.
38 38
39 \ingroup qtopiaemb 39 \ingroup qtopiaemb
40*/ 40*/
41 41
42class TimeZoneSelectorPrivate 42class TimeZoneSelectorPrivate
43{ 43{
44public: 44public:
45 TimeZoneSelectorPrivate() : includeLocal(FALSE) {} 45 TimeZoneSelectorPrivate() : includeLocal(FALSE) {}
46 bool includeLocal; 46 bool includeLocal;
47}; 47};
48 48
49TZCombo::TZCombo( QWidget *p, const char* n ) 49TZCombo::TZCombo( QWidget *p, const char* n )
50 : QComboBox( p, n ) 50 : QComboBox( p, n )
51{ 51{
52 updateZones(); 52 updateZones();
53 // check to see if TZ is set, if it is set the current item to that 53 // check to see if TZ is set, if it is set the current item to that
54 QString tz = getenv("TZ"); 54 QString tz = getenv("TZ");
55 if (parent()->inherits("TimeZoneSelector")) { 55 if (parent()->inherits("TimeZoneSelector")) {
56 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 56 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
57 // overide to the 'local' type. 57 // overide to the 'local' type.
58 tz = "None"; 58 tz = "None";
59 } 59 }
60 } 60 }
61 if ( !tz.isNull() ) { 61 if ( !tz.isNull() ) {
62 int n = 0, 62 int n = 0,
63 index = 0; 63 index = 0;
64 for ( QStringList::Iterator it=identifiers.begin(); 64 for ( QStringList::Iterator it=identifiers.begin();
65 it!=identifiers.end(); ++it) { 65 it!=identifiers.end(); ++it) {
66 if ( *it == tz ) 66 if ( *it == tz )
67 index = n; 67 index = n;
68 n++; 68 n++;
69 } 69 }
70 setCurrentItem(index); 70 setCurrentItem(index);
71 } else { 71 } else {
72 setCurrentItem(0); 72 setCurrentItem(0);
73 } 73 }
74 74
75 75
76 76
77 // listen on QPE/System 77 // listen on QPE/System
78#if !defined(QT_NO_COP) 78#if !defined(QT_NO_COP)
79 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 79 QCopChannel *channel = new QCopChannel( "QPE/System", this );
80 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 80 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
81 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); 81 this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) );
82#endif 82#endif
83 83
84 84
85} 85}
86 86
87TZCombo::~TZCombo() 87TZCombo::~TZCombo()
88{ 88{
89} 89}
90 90
91void TZCombo::updateZones() 91void TZCombo::updateZones()
92{ 92{
93 QString cur = currentText(); 93 QString cur = currentText();
94 clear(); 94 clear();
95 identifiers.clear(); 95 identifiers.clear();
96 int curix=0; 96 int curix=0;
97 QString tz = getenv("TZ"); 97 QString tz = getenv("TZ");
98 bool tzFound = FALSE; 98 bool tzFound = FALSE;
99 Config cfg("CityTime"); 99 Config cfg("CityTime");
100 cfg.setGroup("TimeZones"); 100 cfg.setGroup("TimeZones");
101 int listIndex = 0; 101 int listIndex = 0;
102 if (parent()->inherits("TimeZoneSelector")) { 102 if (parent()->inherits("TimeZoneSelector")) {
103 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 103 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
104 // overide to the 'local' type. 104 // overide to the 'local' type.
105 identifiers.append( "None" ); 105 identifiers.append( "None" );
106 insertItem( tr("None") ); 106 insertItem( tr("None") );
107 if ( cur == tr("None")) 107 if ( cur == tr("None"))
108 curix = 0; 108 curix = 0;
109 listIndex++; 109 listIndex++;
110 } 110 }
111 } 111 }
112 int cfgIndex = 0; 112 int cfgIndex = 0;
113 while (1) { 113 while (1) {
114 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); 114 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null);
115 if ( zn.isNull() ) 115 if ( zn.isNull() )
116 break; 116 break;
117 if ( zn == tz ) 117 if ( zn == tz )
118 tzFound = TRUE; 118 tzFound = TRUE;
119 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); 119 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex));
120 identifiers.append(zn); 120 identifiers.append(zn);
121 insertItem(nm); 121 insertItem(nm);
122 if ( nm == cur ) 122 if ( nm == cur )
123 curix = listIndex; 123 curix = listIndex;
124 ++cfgIndex; 124 ++cfgIndex;
125 ++listIndex; 125 ++listIndex;
126 } 126 }
127 if ( !listIndex ) { 127 if ( !listIndex ) {
128 QStringList list = timezoneDefaults(); 128 QStringList list = timezoneDefaults();
129 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { 129 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) {
@@ -173,98 +173,98 @@ void TZCombo::mousePressEvent(QMouseEvent*e)
173} 173}
174 174
175QString TZCombo::currZone() const 175QString TZCombo::currZone() const
176{ 176{
177 return identifiers[currentItem()]; 177 return identifiers[currentItem()];
178} 178}
179 179
180void TZCombo::setCurrZone( const QString& id ) 180void TZCombo::setCurrZone( const QString& id )
181{ 181{
182 for (int i=0; i< count(); i++) { 182 for (int i=0; i< count(); i++) {
183 if ( identifiers[i] == id ) { 183 if ( identifiers[i] == id ) {
184 setCurrentItem(i); 184 setCurrentItem(i);
185 return; 185 return;
186} 186}
187 } 187 }
188 insertItem(id); 188 insertItem(id);
189 setCurrentItem( count() - 1); 189 setCurrentItem( count() - 1);
190 identifiers.append(id); 190 identifiers.append(id);
191 extras.append(id); 191 extras.append(id);
192} 192}
193 193
194 194
195 195
196void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&) 196void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&)
197{ 197{
198 if ( msg == "timeZoneListChange()" ) { 198 if ( msg == "timeZoneListChange()" ) {
199 updateZones(); 199 updateZones();
200 } 200 }
201} 201}
202 202
203/*! 203/*!
204 Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be 204 Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be
205 populated with the available timezones. 205 populated with the available timezones.
206*/ 206*/
207 207
208TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) : 208TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) :
209 QHBox(p,n) 209 QHBox(p,n)
210{ 210{
211 d = new TimeZoneSelectorPrivate(); 211 d = new TimeZoneSelectorPrivate();
212 // build the combobox before we do any updates... 212 // build the combobox before we do any updates...
213 cmbTz = new TZCombo( this, "timezone combo" ); 213 cmbTz = new TZCombo( this, "timezone combo" );
214 214
215 cmdTz = new QToolButton( this, "timezone button" ); 215 cmdTz = new QToolButton( this, "timezone button" );
216 cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) ); 216 cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) );
217 cmdTz->setMaximumSize( cmdTz->sizeHint() ); 217 cmdTz->setMaximumSize( cmdTz->sizeHint() );
218 218
219 // set up a connection to catch a newly selected item and throw our 219 // set up a connection to catch a newly selected item and throw our
220 // signal 220 // signal
221 QObject::connect( cmbTz, SIGNAL( activated( int ) ), 221 QObject::connect( cmbTz, SIGNAL( activated(int) ),
222 this, SLOT( slotTzActive( int ) ) ); 222 this, SLOT( slotTzActive(int) ) );
223 QObject::connect( cmdTz, SIGNAL( clicked() ), 223 QObject::connect( cmdTz, SIGNAL( clicked() ),
224 this, SLOT( slotExecute() ) ); 224 this, SLOT( slotExecute() ) );
225} 225}
226 226
227/*! 227/*!
228 Destroys a TimeZoneSelector. 228 Destroys a TimeZoneSelector.
229*/ 229*/
230TimeZoneSelector::~TimeZoneSelector() 230TimeZoneSelector::~TimeZoneSelector()
231{ 231{
232} 232}
233 233
234void TimeZoneSelector::setLocalIncluded(bool b) 234void TimeZoneSelector::setLocalIncluded(bool b)
235{ 235{
236 d->includeLocal = b; 236 d->includeLocal = b;
237 cmbTz->updateZones(); 237 cmbTz->updateZones();
238} 238}
239 239
240bool TimeZoneSelector::localIncluded() const 240bool TimeZoneSelector::localIncluded() const
241{ 241{
242 return d->includeLocal; 242 return d->includeLocal;
243} 243}
244 244
245/*! 245/*!
246 Returns the currently selected timezone as a string in location format, e.g. 246 Returns the currently selected timezone as a string in location format, e.g.
247 \code Australia/Brisbane \endcode 247 \code Australia/Brisbane \endcode
248*/ 248*/
249QString TimeZoneSelector::currentZone() const 249QString TimeZoneSelector::currentZone() const
250{ 250{
251 return cmbTz->currZone(); 251 return cmbTz->currZone();
252} 252}
253 253
254/*! 254/*!
255 Sets the current timezone to \a id. 255 Sets the current timezone to \a id.
256*/ 256*/
257void TimeZoneSelector::setCurrentZone( const QString& id ) 257void TimeZoneSelector::setCurrentZone( const QString& id )
258{ 258{
259 cmbTz->setCurrZone( id ); 259 cmbTz->setCurrZone( id );
260} 260}
261/*! \fn void TimeZoneSelector::signalNewTz( const QString& id ) 261/*! \fn void TimeZoneSelector::signalNewTz( const QString& id )
262 This signal is emitted when a timezone has been selected by the user. The id 262 This signal is emitted when a timezone has been selected by the user. The id
263 is a \l QString in location format, eg \code Australia/Brisbane \endcode 263 is a \l QString in location format, eg \code Australia/Brisbane \endcode
264*/ 264*/
265 265
266 266
267void TimeZoneSelector::slotTzActive( int ) 267void TimeZoneSelector::slotTzActive( int )
268{ 268{
269 emit signalNewTz( cmbTz->currZone() ); 269 emit signalNewTz( cmbTz->currZone() );
270} 270}