author | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
commit | 0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff) | |
tree | 503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /libopie | |
parent | a0981652d61776d70f25980f035748b21339e946 (diff) | |
download | opie-0d59c780513da78033f4d9040475dee9db0256d4.zip opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2 |
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you
can check the diff (but it had compiled and run here)
-rw-r--r-- | libopie/big-screen/example/osplitter_mail.cpp | 4 | ||||
-rw-r--r-- | libopie/colordialog.cpp | 8 | ||||
-rw-r--r-- | libopie/colorpopupmenu.cpp | 2 | ||||
-rw-r--r-- | libopie/ocolorbutton.cpp | 2 | ||||
-rw-r--r-- | libopie/odevice.cpp | 16 | ||||
-rw-r--r-- | libopie/ofileselector.cpp | 14 | ||||
-rw-r--r-- | libopie/ofontselector.cpp | 8 | ||||
-rw-r--r-- | libopie/orecurrancewidget.cpp | 4 | ||||
-rw-r--r-- | libopie/otabwidget.cpp | 4 | ||||
-rw-r--r-- | libopie/otimepicker.cpp | 12 | ||||
-rw-r--r-- | libopie/pim/ocontactaccess.cpp | 13 | ||||
-rw-r--r-- | libopie/pim/opimmainwindow.cpp | 8 |
12 files changed, 50 insertions, 45 deletions
diff --git a/libopie/big-screen/example/osplitter_mail.cpp b/libopie/big-screen/example/osplitter_mail.cpp index 4eaf3a9..4356baa 100644 --- a/libopie/big-screen/example/osplitter_mail.cpp +++ b/libopie/big-screen/example/osplitter_mail.cpp | |||
@@ -1,80 +1,80 @@ | |||
1 | 1 | ||
2 | #include <qstring.h> | 2 | #include <qstring.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qheader.h> | 4 | #include <qheader.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | 6 | ||
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | #include <opie/oapplicationfactory.h> | 8 | #include <opie/oapplicationfactory.h> |
9 | 9 | ||
10 | #include "../osplitter.h" | 10 | #include "../osplitter.h" |
11 | 11 | ||
12 | #include "osplitter_mail.h" | 12 | #include "osplitter_mail.h" |
13 | 13 | ||
14 | 14 | ||
15 | OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) | 15 | OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) |
16 | 16 | ||
17 | class Folder { | 17 | class Folder { |
18 | int dummy; | 18 | int dummy; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | // ----------------------------------------------------------------- | 21 | // ----------------------------------------------------------------- |
22 | 22 | ||
23 | ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) | 23 | ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) |
24 | : QWidget( p, name, fl ) { | 24 | : QWidget( p, name, fl ) { |
25 | qApp->installEventFilter( this ); | 25 | qApp->installEventFilter( this ); |
26 | m_lstFolders.setAutoDelete( true ); | 26 | m_lstFolders.setAutoDelete( true ); |
27 | QHBoxLayout *lay = new QHBoxLayout(this); | 27 | QHBoxLayout *lay = new QHBoxLayout(this); |
28 | 28 | ||
29 | m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); | 29 | m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); |
30 | lay->addWidget( m_splitter ); | 30 | lay->addWidget( m_splitter ); |
31 | connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ), | 31 | connect(m_splitter, SIGNAL(sizeChange(bool,const QSize&) ), |
32 | this, SLOT(slotSizeChange(bool, const QSize& ) ) ); | 32 | this, SLOT(slotSizeChange(bool,const QSize&) ) ); |
33 | 33 | ||
34 | m_overview = new QListView( m_splitter ); | 34 | m_overview = new QListView( m_splitter ); |
35 | m_overview->header()->setClickEnabled( FALSE ); | 35 | m_overview->header()->setClickEnabled( FALSE ); |
36 | m_overview->addColumn( tr("Folder") ); | 36 | m_overview->addColumn( tr("Folder") ); |
37 | m_overview->setMaximumWidth( 200 ); | 37 | m_overview->setMaximumWidth( 200 ); |
38 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); | 38 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); |
39 | m_splitter->setSizeChange( 300 ); | 39 | m_splitter->setSizeChange( 300 ); |
40 | 40 | ||
41 | /* OSplitter starts with the small mode */ | 41 | /* OSplitter starts with the small mode */ |
42 | m_messages = 0; | 42 | m_messages = 0; |
43 | m_message = m_attach = 0; | 43 | m_message = m_attach = 0; |
44 | 44 | ||
45 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); | 45 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); |
46 | splitti->setSizeChange( 300 ); | 46 | splitti->setSizeChange( 300 ); |
47 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 47 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
48 | 48 | ||
49 | QLabel *lbl = new QLabel(splitti); | 49 | QLabel *lbl = new QLabel(splitti); |
50 | lbl->setTextFormat ( Qt::RichText ); | 50 | lbl->setTextFormat ( Qt::RichText ); |
51 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); | 51 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); |
52 | 52 | ||
53 | m_messages = new QListView( splitti ); | 53 | m_messages = new QListView( splitti ); |
54 | m_messages->addColumn(" Messages "); | 54 | m_messages->addColumn(" Messages "); |
55 | 55 | ||
56 | folder1 = new QListView( splitti ); | 56 | folder1 = new QListView( splitti ); |
57 | folder1->addColumn( "Messages 2 " ); | 57 | folder1->addColumn( "Messages 2 " ); |
58 | 58 | ||
59 | splitti->addWidget(m_messages, "mail", tr("Mails") ); | 59 | splitti->addWidget(m_messages, "mail", tr("Mails") ); |
60 | splitti->addWidget(folder1, "folder", tr("Folder") ); | 60 | splitti->addWidget(folder1, "folder", tr("Folder") ); |
61 | splitti->addWidget( lbl, "logo", tr("Label") ); | 61 | splitti->addWidget( lbl, "logo", tr("Label") ); |
62 | m_message = lbl; | 62 | m_message = lbl; |
63 | 63 | ||
64 | m_splitter->addWidget( splitti ); | 64 | m_splitter->addWidget( splitti ); |
65 | 65 | ||
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | ListViews::~ListViews() { | 69 | ListViews::~ListViews() { |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
74 | bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { | 74 | bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { |
75 | if (!obj->isWidgetType() ) | 75 | if (!obj->isWidgetType() ) |
76 | return false; | 76 | return false; |
77 | if ( ev->type() == QEvent::MouseButtonRelease ) { | 77 | if ( ev->type() == QEvent::MouseButtonRelease ) { |
78 | qWarning(" name %s, class %s", obj->name(), obj->className() ); | 78 | qWarning(" name %s, class %s", obj->name(), obj->className() ); |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/libopie/colordialog.cpp b/libopie/colordialog.cpp index d46da41..b2854a6 100644 --- a/libopie/colordialog.cpp +++ b/libopie/colordialog.cpp | |||
@@ -427,100 +427,100 @@ protected: | |||
427 | private: | 427 | private: |
428 | QColor col; | 428 | QColor col; |
429 | bool mousePressed; | 429 | bool mousePressed; |
430 | QPoint pressPos; | 430 | QPoint pressPos; |
431 | 431 | ||
432 | }; | 432 | }; |
433 | 433 | ||
434 | void QColorShowLabel::drawContents( QPainter *p ) | 434 | void QColorShowLabel::drawContents( QPainter *p ) |
435 | { | 435 | { |
436 | p->fillRect( contentsRect(), col ); | 436 | p->fillRect( contentsRect(), col ); |
437 | } | 437 | } |
438 | 438 | ||
439 | void QColorShower::showAlpha( bool b ) | 439 | void QColorShower::showAlpha( bool b ) |
440 | { | 440 | { |
441 | if ( b ) { | 441 | if ( b ) { |
442 | alphaLab->show(); | 442 | alphaLab->show(); |
443 | alphaEd->show(); | 443 | alphaEd->show(); |
444 | } else { | 444 | } else { |
445 | alphaLab->hide(); | 445 | alphaLab->hide(); |
446 | alphaEd->hide(); | 446 | alphaEd->hide(); |
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | void QColorShowLabel::mousePressEvent( QMouseEvent *e ) | 450 | void QColorShowLabel::mousePressEvent( QMouseEvent *e ) |
451 | { | 451 | { |
452 | mousePressed = TRUE; | 452 | mousePressed = TRUE; |
453 | pressPos = e->pos(); | 453 | pressPos = e->pos(); |
454 | } | 454 | } |
455 | 455 | ||
456 | void QColorShowLabel::mouseReleaseEvent( QMouseEvent * ) | 456 | void QColorShowLabel::mouseReleaseEvent( QMouseEvent * ) |
457 | { | 457 | { |
458 | if ( !mousePressed ) | 458 | if ( !mousePressed ) |
459 | return; | 459 | return; |
460 | mousePressed = FALSE; | 460 | mousePressed = FALSE; |
461 | } | 461 | } |
462 | 462 | ||
463 | QColorShower::QColorShower( QWidget *parent, const char *name ) | 463 | QColorShower::QColorShower( QWidget *parent, const char *name ) |
464 | :QWidget( parent, name) | 464 | :QWidget( parent, name) |
465 | { | 465 | { |
466 | curCol = qRgb( -1, -1, -1 ); | 466 | curCol = qRgb( -1, -1, -1 ); |
467 | QColIntValidator *val256 = new QColIntValidator( 0, 255, this ); | 467 | QColIntValidator *val256 = new QColIntValidator( 0, 255, this ); |
468 | QColIntValidator *val360 = new QColIntValidator( 0, 360, this ); | 468 | QColIntValidator *val360 = new QColIntValidator( 0, 360, this ); |
469 | 469 | ||
470 | QGridLayout *gl = new QGridLayout( this, 1, 1, 2 ); | 470 | QGridLayout *gl = new QGridLayout( this, 1, 1, 2 ); |
471 | gl->setMargin( 0 ); | 471 | gl->setMargin( 0 ); |
472 | lab = new QColorShowLabel( this ); | 472 | lab = new QColorShowLabel( this ); |
473 | lab->setMinimumWidth( 60 ); //### | 473 | lab->setMinimumWidth( 60 ); //### |
474 | gl->addMultiCellWidget(lab, 0,-1,0,0); | 474 | gl->addMultiCellWidget(lab, 0,-1,0,0); |
475 | connect( lab, SIGNAL( colorDropped( QRgb ) ), | 475 | connect( lab, SIGNAL( colorDropped(QRgb) ), |
476 | this, SIGNAL( newCol( QRgb ) ) ); | 476 | this, SIGNAL( newCol(QRgb) ) ); |
477 | connect( lab, SIGNAL( colorDropped( QRgb ) ), | 477 | connect( lab, SIGNAL( colorDropped(QRgb) ), |
478 | this, SLOT( setRgb( QRgb ) ) ); | 478 | this, SLOT( setRgb(QRgb) ) ); |
479 | 479 | ||
480 | hEd = new QColNumLineEdit( this ); | 480 | hEd = new QColNumLineEdit( this ); |
481 | hEd->setValidator( val360 ); | 481 | hEd->setValidator( val360 ); |
482 | QLabel *l = new QLabel( hEd, OColorDialog::tr("Hue:"), this ); | 482 | QLabel *l = new QLabel( hEd, OColorDialog::tr("Hue:"), this ); |
483 | l->setAlignment( AlignRight|AlignVCenter ); | 483 | l->setAlignment( AlignRight|AlignVCenter ); |
484 | gl->addWidget( l, 0, 1 ); | 484 | gl->addWidget( l, 0, 1 ); |
485 | gl->addWidget( hEd, 0, 2 ); | 485 | gl->addWidget( hEd, 0, 2 ); |
486 | 486 | ||
487 | sEd = new QColNumLineEdit( this ); | 487 | sEd = new QColNumLineEdit( this ); |
488 | sEd->setValidator( val256 ); | 488 | sEd->setValidator( val256 ); |
489 | l = new QLabel( sEd, OColorDialog::tr("Sat:"), this ); | 489 | l = new QLabel( sEd, OColorDialog::tr("Sat:"), this ); |
490 | l->setAlignment( AlignRight|AlignVCenter ); | 490 | l->setAlignment( AlignRight|AlignVCenter ); |
491 | gl->addWidget( l, 1, 1 ); | 491 | gl->addWidget( l, 1, 1 ); |
492 | gl->addWidget( sEd, 1, 2 ); | 492 | gl->addWidget( sEd, 1, 2 ); |
493 | 493 | ||
494 | vEd = new QColNumLineEdit( this ); | 494 | vEd = new QColNumLineEdit( this ); |
495 | vEd->setValidator( val256 ); | 495 | vEd->setValidator( val256 ); |
496 | l = new QLabel( vEd, OColorDialog::tr("Val:"), this ); | 496 | l = new QLabel( vEd, OColorDialog::tr("Val:"), this ); |
497 | l->setAlignment( AlignRight|AlignVCenter ); | 497 | l->setAlignment( AlignRight|AlignVCenter ); |
498 | gl->addWidget( l, 2, 1 ); | 498 | gl->addWidget( l, 2, 1 ); |
499 | gl->addWidget( vEd, 2, 2 ); | 499 | gl->addWidget( vEd, 2, 2 ); |
500 | 500 | ||
501 | rEd = new QColNumLineEdit( this ); | 501 | rEd = new QColNumLineEdit( this ); |
502 | rEd->setValidator( val256 ); | 502 | rEd->setValidator( val256 ); |
503 | l = new QLabel( rEd, OColorDialog::tr("Red:"), this ); | 503 | l = new QLabel( rEd, OColorDialog::tr("Red:"), this ); |
504 | l->setAlignment( AlignRight|AlignVCenter ); | 504 | l->setAlignment( AlignRight|AlignVCenter ); |
505 | gl->addWidget( l, 0, 3 ); | 505 | gl->addWidget( l, 0, 3 ); |
506 | gl->addWidget( rEd, 0, 4 ); | 506 | gl->addWidget( rEd, 0, 4 ); |
507 | 507 | ||
508 | gEd = new QColNumLineEdit( this ); | 508 | gEd = new QColNumLineEdit( this ); |
509 | gEd->setValidator( val256 ); | 509 | gEd->setValidator( val256 ); |
510 | l = new QLabel( gEd, OColorDialog::tr("Green:"), this ); | 510 | l = new QLabel( gEd, OColorDialog::tr("Green:"), this ); |
511 | l->setAlignment( AlignRight|AlignVCenter ); | 511 | l->setAlignment( AlignRight|AlignVCenter ); |
512 | gl->addWidget( l, 1, 3 ); | 512 | gl->addWidget( l, 1, 3 ); |
513 | gl->addWidget( gEd, 1, 4 ); | 513 | gl->addWidget( gEd, 1, 4 ); |
514 | 514 | ||
515 | bEd = new QColNumLineEdit( this ); | 515 | bEd = new QColNumLineEdit( this ); |
516 | bEd->setValidator( val256 ); | 516 | bEd->setValidator( val256 ); |
517 | l = new QLabel( bEd, OColorDialog::tr("Blue:"), this ); | 517 | l = new QLabel( bEd, OColorDialog::tr("Blue:"), this ); |
518 | l->setAlignment( AlignRight|AlignVCenter ); | 518 | l->setAlignment( AlignRight|AlignVCenter ); |
519 | gl->addWidget( l, 2, 3 ); | 519 | gl->addWidget( l, 2, 3 ); |
520 | gl->addWidget( bEd, 2, 4 ); | 520 | gl->addWidget( bEd, 2, 4 ); |
521 | 521 | ||
522 | alphaEd = new QColNumLineEdit( this ); | 522 | alphaEd = new QColNumLineEdit( this ); |
523 | alphaEd->setValidator( val256 ); | 523 | alphaEd->setValidator( val256 ); |
524 | alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this ); | 524 | alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this ); |
525 | alphaLab->setAlignment( AlignRight|AlignVCenter ); | 525 | alphaLab->setAlignment( AlignRight|AlignVCenter ); |
526 | gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 ); | 526 | gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 ); |
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp index 0d66fba..03ad233 100644 --- a/libopie/colorpopupmenu.cpp +++ b/libopie/colorpopupmenu.cpp | |||
@@ -107,66 +107,66 @@ OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const ch | |||
107 | addColor(QColor(0, 0, 0), 0, 5); | 107 | addColor(QColor(0, 0, 0), 0, 5); |
108 | 108 | ||
109 | addColor(QColor(255, 0, 0), 1, 0); | 109 | addColor(QColor(255, 0, 0), 1, 0); |
110 | addColor(QColor(255, 128, 0), 1, 1); | 110 | addColor(QColor(255, 128, 0), 1, 1); |
111 | addColor(QColor(255, 255, 0), 1, 2); | 111 | addColor(QColor(255, 255, 0), 1, 2); |
112 | addColor(QColor(128, 255, 0), 1, 3); | 112 | addColor(QColor(128, 255, 0), 1, 3); |
113 | addColor(QColor(0, 255, 0), 1, 4); | 113 | addColor(QColor(0, 255, 0), 1, 4); |
114 | addColor(QColor(0, 255, 128), 1, 5); | 114 | addColor(QColor(0, 255, 128), 1, 5); |
115 | 115 | ||
116 | addColor(QColor(128, 0, 0), 2, 0); | 116 | addColor(QColor(128, 0, 0), 2, 0); |
117 | addColor(QColor(128, 64, 0), 2, 1); | 117 | addColor(QColor(128, 64, 0), 2, 1); |
118 | addColor(QColor(128, 128, 0), 2, 2); | 118 | addColor(QColor(128, 128, 0), 2, 2); |
119 | addColor(QColor(64, 128, 0), 2, 3); | 119 | addColor(QColor(64, 128, 0), 2, 3); |
120 | addColor(QColor(0, 128, 0), 2, 4); | 120 | addColor(QColor(0, 128, 0), 2, 4); |
121 | addColor(QColor(0, 128, 64), 2, 5); | 121 | addColor(QColor(0, 128, 64), 2, 5); |
122 | 122 | ||
123 | addColor(QColor(0, 255, 255), 3, 0); | 123 | addColor(QColor(0, 255, 255), 3, 0); |
124 | addColor(QColor(0, 128, 255), 3, 1); | 124 | addColor(QColor(0, 128, 255), 3, 1); |
125 | addColor(QColor(0, 0, 255), 3, 2); | 125 | addColor(QColor(0, 0, 255), 3, 2); |
126 | addColor(QColor(128, 0, 255), 3, 3); | 126 | addColor(QColor(128, 0, 255), 3, 3); |
127 | addColor(QColor(255, 0, 255), 3, 4); | 127 | addColor(QColor(255, 0, 255), 3, 4); |
128 | addColor(QColor(255, 0, 128), 3, 5); | 128 | addColor(QColor(255, 0, 128), 3, 5); |
129 | 129 | ||
130 | addColor(QColor(0, 128, 128), 4, 0); | 130 | addColor(QColor(0, 128, 128), 4, 0); |
131 | addColor(QColor(0, 64, 128), 4, 1); | 131 | addColor(QColor(0, 64, 128), 4, 1); |
132 | addColor(QColor(0, 0, 128), 4, 2); | 132 | addColor(QColor(0, 0, 128), 4, 2); |
133 | addColor(QColor(64, 0, 128), 4, 3); | 133 | addColor(QColor(64, 0, 128), 4, 3); |
134 | addColor(QColor(128, 0, 128), 4, 4); | 134 | addColor(QColor(128, 0, 128), 4, 4); |
135 | addColor(QColor(128, 0, 64), 4, 5); | 135 | addColor(QColor(128, 0, 64), 4, 5); |
136 | 136 | ||
137 | insertItem( colorPanel ); | 137 | insertItem( colorPanel ); |
138 | insertSeparator(); | 138 | insertSeparator(); |
139 | insertItem(tr("More"),this,SLOT( moreColorClicked())); | 139 | insertItem(tr("More"),this,SLOT( moreColorClicked())); |
140 | /* | 140 | /* |
141 | QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); | 141 | QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); |
142 | connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); | 142 | connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); |
143 | chooseColorAction->addTo( this ); | 143 | chooseColorAction->addTo( this ); |
144 | */ | 144 | */ |
145 | activateItemAt( 0 ); | 145 | activateItemAt( 0 ); |
146 | } | 146 | } |
147 | 147 | ||
148 | OColorPopupMenu::~OColorPopupMenu() | 148 | OColorPopupMenu::~OColorPopupMenu() |
149 | { | 149 | { |
150 | } | 150 | } |
151 | 151 | ||
152 | void OColorPopupMenu::addColor( const QColor& color, int row, int col ) | 152 | void OColorPopupMenu::addColor( const QColor& color, int row, int col ) |
153 | { | 153 | { |
154 | OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); | 154 | OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); |
155 | connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); | 155 | connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) ); |
156 | colorLayout->addWidget( panelButton, row, col ); | 156 | colorLayout->addWidget( panelButton, row, col ); |
157 | } | 157 | } |
158 | 158 | ||
159 | void OColorPopupMenu::buttonSelected( const QColor& color ) | 159 | void OColorPopupMenu::buttonSelected( const QColor& color ) |
160 | { | 160 | { |
161 | m_color = color; | 161 | m_color = color; |
162 | emit colorSelected( color ); | 162 | emit colorSelected( color ); |
163 | hide(); | 163 | hide(); |
164 | } | 164 | } |
165 | 165 | ||
166 | void OColorPopupMenu::moreColorClicked() | 166 | void OColorPopupMenu::moreColorClicked() |
167 | { | 167 | { |
168 | QColor color = OColorDialog::getColor( m_color ); | 168 | QColor color = OColorDialog::getColor( m_color ); |
169 | m_color = color; | 169 | m_color = color; |
170 | emit colorSelected( color ); | 170 | emit colorSelected( color ); |
171 | hide(); | 171 | hide(); |
172 | } | 172 | } |
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp index 93fe5d0..298dba2 100644 --- a/libopie/ocolorbutton.cpp +++ b/libopie/ocolorbutton.cpp | |||
@@ -8,97 +8,97 @@ | |||
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <opie/colorpopupmenu.h> | 29 | #include <opie/colorpopupmenu.h> |
30 | #include <opie/ocolorbutton.h> | 30 | #include <opie/ocolorbutton.h> |
31 | 31 | ||
32 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
33 | 33 | ||
34 | struct OColorButtonPrivate { | 34 | struct OColorButtonPrivate { |
35 | QPopupMenu *m_menu; | 35 | QPopupMenu *m_menu; |
36 | QColor m_color; | 36 | QColor m_color; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | 39 | ||
40 | /** | 40 | /** |
41 | * This concstructs a Color Button with @param color as the start color | 41 | * This concstructs a Color Button with @param color as the start color |
42 | * It'll use a OColorPopupMenu internally | 42 | * It'll use a OColorPopupMenu internally |
43 | * | 43 | * |
44 | * @param parent The parent of the Color Button | 44 | * @param parent The parent of the Color Button |
45 | * @param color The color from where to start on | 45 | * @param color The color from where to start on |
46 | * @param name @see QObject | 46 | * @param name @see QObject |
47 | */ | 47 | */ |
48 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) | 48 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) |
49 | : QPushButton ( parent, name ) | 49 | : QPushButton ( parent, name ) |
50 | { | 50 | { |
51 | d = new OColorButtonPrivate; | 51 | d = new OColorButtonPrivate; |
52 | 52 | ||
53 | d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); | 53 | d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); |
54 | setPopup ( d-> m_menu ); | 54 | setPopup ( d-> m_menu ); |
55 | //setPopupDelay ( 0 ); | 55 | //setPopupDelay ( 0 ); |
56 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); | 56 | connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&))); |
57 | 57 | ||
58 | updateColor ( color ); | 58 | updateColor ( color ); |
59 | 59 | ||
60 | QSize s = sizeHint ( ) + QSize ( 12, 0 ); | 60 | QSize s = sizeHint ( ) + QSize ( 12, 0 ); |
61 | setMinimumSize ( s ); | 61 | setMinimumSize ( s ); |
62 | setMaximumSize ( s. width ( ) * 2, s. height ( )); | 62 | setMaximumSize ( s. width ( ) * 2, s. height ( )); |
63 | } | 63 | } |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * This destructs the object | 66 | * This destructs the object |
67 | */ | 67 | */ |
68 | OColorButton::~OColorButton ( ) | 68 | OColorButton::~OColorButton ( ) |
69 | { | 69 | { |
70 | delete d; | 70 | delete d; |
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * @return Returns the current color of the button | 74 | * @return Returns the current color of the button |
75 | */ | 75 | */ |
76 | QColor OColorButton::color ( ) const | 76 | QColor OColorButton::color ( ) const |
77 | { | 77 | { |
78 | return d-> m_color; | 78 | return d-> m_color; |
79 | } | 79 | } |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * This method sets the color of the button | 82 | * This method sets the color of the button |
83 | * @param c The color to be set. | 83 | * @param c The color to be set. |
84 | */ | 84 | */ |
85 | void OColorButton::setColor ( const QColor &c ) | 85 | void OColorButton::setColor ( const QColor &c ) |
86 | { | 86 | { |
87 | updateColor ( c ); | 87 | updateColor ( c ); |
88 | } | 88 | } |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * @internal | 91 | * @internal |
92 | */ | 92 | */ |
93 | void OColorButton::updateColor ( const QColor &c ) | 93 | void OColorButton::updateColor ( const QColor &c ) |
94 | { | 94 | { |
95 | d-> m_color = c; | 95 | d-> m_color = c; |
96 | 96 | ||
97 | QImage img ( 16, 16, 32 ); | 97 | QImage img ( 16, 16, 32 ); |
98 | img. fill ( 0 ); | 98 | img. fill ( 0 ); |
99 | 99 | ||
100 | int r, g, b; | 100 | int r, g, b; |
101 | c. rgb ( &r, &g, &b ); | 101 | c. rgb ( &r, &g, &b ); |
102 | 102 | ||
103 | int w = img. width ( ); | 103 | int w = img. width ( ); |
104 | int h = img. height ( ); | 104 | int h = img. height ( ); |
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index c0b6efa..4258d60 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -487,97 +487,97 @@ ODevice::ODevice ( ) | |||
487 | d-> m_rotation = Rot0; | 487 | d-> m_rotation = Rot0; |
488 | d-> m_direction = CW; | 488 | d-> m_direction = CW; |
489 | 489 | ||
490 | d-> m_holdtime = 1000; // 1000ms | 490 | d-> m_holdtime = 1000; // 1000ms |
491 | d-> m_buttons = 0; | 491 | d-> m_buttons = 0; |
492 | d-> m_cpu_frequencies = new QStrList; | 492 | d-> m_cpu_frequencies = new QStrList; |
493 | } | 493 | } |
494 | 494 | ||
495 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 495 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
496 | { | 496 | { |
497 | if ( msg == "deviceButtonMappingChanged()" ) { | 497 | if ( msg == "deviceButtonMappingChanged()" ) { |
498 | reloadButtonMapping ( ); | 498 | reloadButtonMapping ( ); |
499 | } | 499 | } |
500 | } | 500 | } |
501 | 501 | ||
502 | void ODevice::init ( ) | 502 | void ODevice::init ( ) |
503 | { | 503 | { |
504 | } | 504 | } |
505 | 505 | ||
506 | /** | 506 | /** |
507 | * This method initialises the button mapping | 507 | * This method initialises the button mapping |
508 | */ | 508 | */ |
509 | void ODevice::initButtons ( ) | 509 | void ODevice::initButtons ( ) |
510 | { | 510 | { |
511 | if ( d-> m_buttons ) | 511 | if ( d-> m_buttons ) |
512 | return; | 512 | return; |
513 | 513 | ||
514 | // Simulation uses iPAQ 3660 device buttons | 514 | // Simulation uses iPAQ 3660 device buttons |
515 | 515 | ||
516 | qDebug ( "init Buttons" ); | 516 | qDebug ( "init Buttons" ); |
517 | d-> m_buttons = new QValueList <ODeviceButton>; | 517 | d-> m_buttons = new QValueList <ODeviceButton>; |
518 | 518 | ||
519 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 519 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
520 | i_button *ib = ipaq_buttons + i; | 520 | i_button *ib = ipaq_buttons + i; |
521 | ODeviceButton b; | 521 | ODeviceButton b; |
522 | 522 | ||
523 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 523 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
524 | b. setKeycode ( ib-> code ); | 524 | b. setKeycode ( ib-> code ); |
525 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 525 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
526 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 526 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
527 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 527 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
528 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 528 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
529 | d-> m_buttons-> append ( b ); | 529 | d-> m_buttons-> append ( b ); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | reloadButtonMapping ( ); | 532 | reloadButtonMapping ( ); |
533 | 533 | ||
534 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 534 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
535 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 535 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
536 | } | 536 | } |
537 | 537 | ||
538 | ODevice::~ODevice ( ) | 538 | ODevice::~ODevice ( ) |
539 | { | 539 | { |
540 | // we leak m_devicebuttons and m_cpu_frequency | 540 | // we leak m_devicebuttons and m_cpu_frequency |
541 | // but it's a singleton and it is not so importantant | 541 | // but it's a singleton and it is not so importantant |
542 | // -zecke | 542 | // -zecke |
543 | delete d; | 543 | delete d; |
544 | } | 544 | } |
545 | 545 | ||
546 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 546 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
547 | { | 547 | { |
548 | return false; | 548 | return false; |
549 | } | 549 | } |
550 | 550 | ||
551 | //#include <linux/apm_bios.h> | 551 | //#include <linux/apm_bios.h> |
552 | 552 | ||
553 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 553 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
554 | 554 | ||
555 | /** | 555 | /** |
556 | * This method will try to suspend the device | 556 | * This method will try to suspend the device |
557 | * It only works if the user is the QWS Server and the apm application | 557 | * It only works if the user is the QWS Server and the apm application |
558 | * is installed. | 558 | * is installed. |
559 | * It tries to suspend and then waits some time cause some distributions | 559 | * It tries to suspend and then waits some time cause some distributions |
560 | * do have asynchronus apm implementations. | 560 | * do have asynchronus apm implementations. |
561 | * This method will either fail and return false or it'll suspend the | 561 | * This method will either fail and return false or it'll suspend the |
562 | * device and return once the device got woken up | 562 | * device and return once the device got woken up |
563 | * | 563 | * |
564 | * @return if the device got suspended | 564 | * @return if the device got suspended |
565 | */ | 565 | */ |
566 | bool ODevice::suspend ( ) | 566 | bool ODevice::suspend ( ) |
567 | { | 567 | { |
568 | qDebug("ODevice::suspend"); | 568 | qDebug("ODevice::suspend"); |
569 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 569 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
570 | return false; | 570 | return false; |
571 | 571 | ||
572 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 572 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
573 | return false; | 573 | return false; |
574 | 574 | ||
575 | bool res = false; | 575 | bool res = false; |
576 | 576 | ||
577 | struct timeval tvs, tvn; | 577 | struct timeval tvs, tvn; |
578 | ::gettimeofday ( &tvs, 0 ); | 578 | ::gettimeofday ( &tvs, 0 ); |
579 | 579 | ||
580 | ::sync ( ); // flush fs caches | 580 | ::sync ( ); // flush fs caches |
581 | res = ( ::system ( "apm --suspend" ) == 0 ); | 581 | res = ( ::system ( "apm --suspend" ) == 0 ); |
582 | 582 | ||
583 | // This is needed because the iPAQ apm implementation is asynchronous and we | 583 | // This is needed because the iPAQ apm implementation is asynchronous and we |
@@ -1067,98 +1067,98 @@ bool Yopy::isYopy ( ) | |||
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | void Yopy::init ( ) | 1069 | void Yopy::init ( ) |
1070 | { | 1070 | { |
1071 | d-> m_vendorstr = "G.Mate"; | 1071 | d-> m_vendorstr = "G.Mate"; |
1072 | d-> m_vendor = Vendor_GMate; | 1072 | d-> m_vendor = Vendor_GMate; |
1073 | d-> m_modelstr = "Yopy3700"; | 1073 | d-> m_modelstr = "Yopy3700"; |
1074 | d-> m_model = Model_Yopy_3700; | 1074 | d-> m_model = Model_Yopy_3700; |
1075 | d-> m_rotation = Rot0; | 1075 | d-> m_rotation = Rot0; |
1076 | 1076 | ||
1077 | d-> m_systemstr = "Linupy"; | 1077 | d-> m_systemstr = "Linupy"; |
1078 | d-> m_system = System_Linupy; | 1078 | d-> m_system = System_Linupy; |
1079 | 1079 | ||
1080 | QFile f ( "/etc/issue" ); | 1080 | QFile f ( "/etc/issue" ); |
1081 | if ( f. open ( IO_ReadOnly )) { | 1081 | if ( f. open ( IO_ReadOnly )) { |
1082 | QTextStream ts ( &f ); | 1082 | QTextStream ts ( &f ); |
1083 | ts.readLine(); | 1083 | ts.readLine(); |
1084 | d-> m_sysverstr = ts. readLine ( ); | 1084 | d-> m_sysverstr = ts. readLine ( ); |
1085 | f. close ( ); | 1085 | f. close ( ); |
1086 | } | 1086 | } |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | void Yopy::initButtons ( ) | 1089 | void Yopy::initButtons ( ) |
1090 | { | 1090 | { |
1091 | if ( d-> m_buttons ) | 1091 | if ( d-> m_buttons ) |
1092 | return; | 1092 | return; |
1093 | 1093 | ||
1094 | d-> m_buttons = new QValueList <ODeviceButton>; | 1094 | d-> m_buttons = new QValueList <ODeviceButton>; |
1095 | 1095 | ||
1096 | for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) { | 1096 | for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) { |
1097 | 1097 | ||
1098 | yopy_button *ib = yopy_buttons + i; | 1098 | yopy_button *ib = yopy_buttons + i; |
1099 | 1099 | ||
1100 | ODeviceButton b; | 1100 | ODeviceButton b; |
1101 | 1101 | ||
1102 | b. setKeycode ( ib-> code ); | 1102 | b. setKeycode ( ib-> code ); |
1103 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 1103 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
1104 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 1104 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
1105 | b. setFactoryPresetPressedAction | 1105 | b. setFactoryPresetPressedAction |
1106 | (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction)); | 1106 | (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction)); |
1107 | b. setFactoryPresetHeldAction | 1107 | b. setFactoryPresetHeldAction |
1108 | (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction)); | 1108 | (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction)); |
1109 | 1109 | ||
1110 | d-> m_buttons-> append ( b ); | 1110 | d-> m_buttons-> append ( b ); |
1111 | } | 1111 | } |
1112 | reloadButtonMapping ( ); | 1112 | reloadButtonMapping ( ); |
1113 | 1113 | ||
1114 | QCopChannel *sysch = new QCopChannel("QPE/System", this); | 1114 | QCopChannel *sysch = new QCopChannel("QPE/System", this); |
1115 | connect(sysch, SIGNAL(received(const QCString &, const QByteArray & )), | 1115 | connect(sysch, SIGNAL(received(const QCString&,const QByteArray&)), |
1116 | this, SLOT(systemMessage(const QCString &, const QByteArray & ))); | 1116 | this, SLOT(systemMessage(const QCString&,const QByteArray&))); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | bool Yopy::suspend() | 1119 | bool Yopy::suspend() |
1120 | { | 1120 | { |
1121 | /* Opie for Yopy does not implement its own power management at the | 1121 | /* Opie for Yopy does not implement its own power management at the |
1122 | moment. The public version runs parallel to X, and relies on the | 1122 | moment. The public version runs parallel to X, and relies on the |
1123 | existing power management features. */ | 1123 | existing power management features. */ |
1124 | return false; | 1124 | return false; |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | bool Yopy::setDisplayBrightness(int bright) | 1127 | bool Yopy::setDisplayBrightness(int bright) |
1128 | { | 1128 | { |
1129 | /* The code here works, but is disabled as the current version runs | 1129 | /* The code here works, but is disabled as the current version runs |
1130 | parallel to X, and relies on the existing backlight demon. */ | 1130 | parallel to X, and relies on the existing backlight demon. */ |
1131 | #if 0 | 1131 | #if 0 |
1132 | if ( QFile::exists("/proc/sys/pm/light") ) { | 1132 | if ( QFile::exists("/proc/sys/pm/light") ) { |
1133 | int fd = ::open("/proc/sys/pm/light", O_WRONLY); | 1133 | int fd = ::open("/proc/sys/pm/light", O_WRONLY); |
1134 | if (fd >= 0 ) { | 1134 | if (fd >= 0 ) { |
1135 | if (bright) | 1135 | if (bright) |
1136 | ::write(fd, "1\n", 2); | 1136 | ::write(fd, "1\n", 2); |
1137 | else | 1137 | else |
1138 | ::write(fd, "0\n", 2); | 1138 | ::write(fd, "0\n", 2); |
1139 | ::close(fd); | 1139 | ::close(fd); |
1140 | return true; | 1140 | return true; |
1141 | } | 1141 | } |
1142 | } | 1142 | } |
1143 | #endif | 1143 | #endif |
1144 | return false; | 1144 | return false; |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | int Yopy::displayBrightnessResolution() const | 1147 | int Yopy::displayBrightnessResolution() const |
1148 | { | 1148 | { |
1149 | return 2; | 1149 | return 2; |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | /************************************************** | 1152 | /************************************************** |
1153 | * | 1153 | * |
1154 | * iPAQ | 1154 | * iPAQ |
1155 | * | 1155 | * |
1156 | **************************************************/ | 1156 | **************************************************/ |
1157 | 1157 | ||
1158 | void iPAQ::init ( ) | 1158 | void iPAQ::init ( ) |
1159 | { | 1159 | { |
1160 | d-> m_vendorstr = "HP"; | 1160 | d-> m_vendorstr = "HP"; |
1161 | d-> m_vendor = Vendor_HP; | 1161 | d-> m_vendor = Vendor_HP; |
1162 | 1162 | ||
1163 | QFile f ( "/proc/hal/model" ); | 1163 | QFile f ( "/proc/hal/model" ); |
1164 | 1164 | ||
@@ -1216,97 +1216,97 @@ void iPAQ::init ( ) | |||
1216 | if ( f. open ( IO_ReadOnly )) { | 1216 | if ( f. open ( IO_ReadOnly )) { |
1217 | d-> m_systemstr = "OpenEmbedded/iPaq"; | 1217 | d-> m_systemstr = "OpenEmbedded/iPaq"; |
1218 | d-> m_system = System_Familiar; | 1218 | d-> m_system = System_Familiar; |
1219 | 1219 | ||
1220 | QTextStream ts ( &f ); | 1220 | QTextStream ts ( &f ); |
1221 | ts.setDevice ( &f ); | 1221 | ts.setDevice ( &f ); |
1222 | d-> m_sysverstr = ts. readLine ( ); | 1222 | d-> m_sysverstr = ts. readLine ( ); |
1223 | f. close ( ); | 1223 | f. close ( ); |
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | 1227 | ||
1228 | 1228 | ||
1229 | 1229 | ||
1230 | 1230 | ||
1231 | m_leds [0] = m_leds [1] = Led_Off; | 1231 | m_leds [0] = m_leds [1] = Led_Off; |
1232 | 1232 | ||
1233 | m_power_timer = 0; | 1233 | m_power_timer = 0; |
1234 | 1234 | ||
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | void iPAQ::initButtons ( ) | 1237 | void iPAQ::initButtons ( ) |
1238 | { | 1238 | { |
1239 | if ( d-> m_buttons ) | 1239 | if ( d-> m_buttons ) |
1240 | return; | 1240 | return; |
1241 | 1241 | ||
1242 | if ( isQWS( ) ) | 1242 | if ( isQWS( ) ) |
1243 | QWSServer::setKeyboardFilter ( this ); | 1243 | QWSServer::setKeyboardFilter ( this ); |
1244 | 1244 | ||
1245 | d-> m_buttons = new QValueList <ODeviceButton>; | 1245 | d-> m_buttons = new QValueList <ODeviceButton>; |
1246 | 1246 | ||
1247 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 1247 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
1248 | i_button *ib = ipaq_buttons + i; | 1248 | i_button *ib = ipaq_buttons + i; |
1249 | ODeviceButton b; | 1249 | ODeviceButton b; |
1250 | 1250 | ||
1251 | if (( ib-> model & d-> m_model ) == d-> m_model ) { | 1251 | if (( ib-> model & d-> m_model ) == d-> m_model ) { |
1252 | b. setKeycode ( ib-> code ); | 1252 | b. setKeycode ( ib-> code ); |
1253 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 1253 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
1254 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 1254 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
1255 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 1255 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
1256 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 1256 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
1257 | 1257 | ||
1258 | d-> m_buttons-> append ( b ); | 1258 | d-> m_buttons-> append ( b ); |
1259 | } | 1259 | } |
1260 | } | 1260 | } |
1261 | reloadButtonMapping ( ); | 1261 | reloadButtonMapping ( ); |
1262 | 1262 | ||
1263 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 1263 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
1264 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 1264 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | 1267 | ||
1268 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 1268 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
1269 | 1269 | ||
1270 | typedef struct { | 1270 | typedef struct { |
1271 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 1271 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
1272 | unsigned char TotalTime; /* Units of 5 seconds */ | 1272 | unsigned char TotalTime; /* Units of 5 seconds */ |
1273 | unsigned char OnTime; /* units of 100m/s */ | 1273 | unsigned char OnTime; /* units of 100m/s */ |
1274 | unsigned char OffTime; /* units of 100m/s */ | 1274 | unsigned char OffTime; /* units of 100m/s */ |
1275 | } LED_IN; | 1275 | } LED_IN; |
1276 | 1276 | ||
1277 | typedef struct { | 1277 | typedef struct { |
1278 | unsigned char mode; | 1278 | unsigned char mode; |
1279 | unsigned char pwr; | 1279 | unsigned char pwr; |
1280 | unsigned char brightness; | 1280 | unsigned char brightness; |
1281 | } FLITE_IN; | 1281 | } FLITE_IN; |
1282 | 1282 | ||
1283 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 1283 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
1284 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 1284 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
1285 | 1285 | ||
1286 | 1286 | ||
1287 | QValueList <OLed> iPAQ::ledList ( ) const | 1287 | QValueList <OLed> iPAQ::ledList ( ) const |
1288 | { | 1288 | { |
1289 | QValueList <OLed> vl; | 1289 | QValueList <OLed> vl; |
1290 | vl << Led_Power; | 1290 | vl << Led_Power; |
1291 | 1291 | ||
1292 | if ( d-> m_model == Model_iPAQ_H38xx ) | 1292 | if ( d-> m_model == Model_iPAQ_H38xx ) |
1293 | vl << Led_BlueTooth; | 1293 | vl << Led_BlueTooth; |
1294 | return vl; | 1294 | return vl; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | 1297 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const |
1298 | { | 1298 | { |
1299 | QValueList <OLedState> vl; | 1299 | QValueList <OLedState> vl; |
1300 | 1300 | ||
1301 | if ( l == Led_Power ) | 1301 | if ( l == Led_Power ) |
1302 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; | 1302 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; |
1303 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) | 1303 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) |
1304 | vl << Led_Off; // << Led_On << ??? | 1304 | vl << Led_Off; // << Led_On << ??? |
1305 | 1305 | ||
1306 | return vl; | 1306 | return vl; |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | OLedState iPAQ::ledState ( OLed l ) const | 1309 | OLedState iPAQ::ledState ( OLed l ) const |
1310 | { | 1310 | { |
1311 | switch ( l ) { | 1311 | switch ( l ) { |
1312 | case Led_Power: | 1312 | case Led_Power: |
@@ -1702,98 +1702,98 @@ void Zaurus::init ( ) | |||
1702 | case Model_Zaurus_SLB600: | 1702 | case Model_Zaurus_SLB600: |
1703 | case Model_Zaurus_SL5500: | 1703 | case Model_Zaurus_SL5500: |
1704 | case Model_Zaurus_SL5000: | 1704 | case Model_Zaurus_SL5000: |
1705 | default: | 1705 | default: |
1706 | d-> m_rotation = Rot270; | 1706 | d-> m_rotation = Rot270; |
1707 | break; | 1707 | break; |
1708 | } | 1708 | } |
1709 | m_leds [0] = Led_Off; | 1709 | m_leds [0] = Led_Off; |
1710 | } | 1710 | } |
1711 | 1711 | ||
1712 | void Zaurus::initButtons ( ) | 1712 | void Zaurus::initButtons ( ) |
1713 | { | 1713 | { |
1714 | if ( d-> m_buttons ) | 1714 | if ( d-> m_buttons ) |
1715 | return; | 1715 | return; |
1716 | 1716 | ||
1717 | d-> m_buttons = new QValueList <ODeviceButton>; | 1717 | d-> m_buttons = new QValueList <ODeviceButton>; |
1718 | 1718 | ||
1719 | struct z_button * pz_buttons; | 1719 | struct z_button * pz_buttons; |
1720 | int buttoncount; | 1720 | int buttoncount; |
1721 | switch ( d-> m_model ) { | 1721 | switch ( d-> m_model ) { |
1722 | case Model_Zaurus_SLC7x0: | 1722 | case Model_Zaurus_SLC7x0: |
1723 | pz_buttons = z_buttons_c700; | 1723 | pz_buttons = z_buttons_c700; |
1724 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 1724 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
1725 | break; | 1725 | break; |
1726 | default: | 1726 | default: |
1727 | pz_buttons = z_buttons; | 1727 | pz_buttons = z_buttons; |
1728 | buttoncount = ARRAY_SIZE(z_buttons); | 1728 | buttoncount = ARRAY_SIZE(z_buttons); |
1729 | break; | 1729 | break; |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | for ( int i = 0; i < buttoncount; i++ ) { | 1732 | for ( int i = 0; i < buttoncount; i++ ) { |
1733 | struct z_button *zb = pz_buttons + i; | 1733 | struct z_button *zb = pz_buttons + i; |
1734 | ODeviceButton b; | 1734 | ODeviceButton b; |
1735 | 1735 | ||
1736 | b. setKeycode ( zb-> code ); | 1736 | b. setKeycode ( zb-> code ); |
1737 | b. setUserText ( QObject::tr ( "Button", zb-> utext )); | 1737 | b. setUserText ( QObject::tr ( "Button", zb-> utext )); |
1738 | b. setPixmap ( Resource::loadPixmap ( zb-> pix )); | 1738 | b. setPixmap ( Resource::loadPixmap ( zb-> pix )); |
1739 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), | 1739 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), |
1740 | zb-> fpressedaction )); | 1740 | zb-> fpressedaction )); |
1741 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), | 1741 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), |
1742 | zb-> fheldaction )); | 1742 | zb-> fheldaction )); |
1743 | 1743 | ||
1744 | d-> m_buttons-> append ( b ); | 1744 | d-> m_buttons-> append ( b ); |
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | reloadButtonMapping ( ); | 1747 | reloadButtonMapping ( ); |
1748 | 1748 | ||
1749 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 1749 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
1750 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), | 1750 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), |
1751 | this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 1751 | this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | #include <unistd.h> | 1754 | #include <unistd.h> |
1755 | #include <fcntl.h> | 1755 | #include <fcntl.h> |
1756 | #include <sys/ioctl.h> | 1756 | #include <sys/ioctl.h> |
1757 | 1757 | ||
1758 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 1758 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
1759 | 1759 | ||
1760 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 1760 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
1761 | 1761 | ||
1762 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1762 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1763 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 1763 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
1764 | 1764 | ||
1765 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 1765 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
1766 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 1766 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
1767 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 1767 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
1768 | 1768 | ||
1769 | /* --- for SHARP_BUZZER device --- */ | 1769 | /* --- for SHARP_BUZZER device --- */ |
1770 | 1770 | ||
1771 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1771 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1772 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 1772 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
1773 | 1773 | ||
1774 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 1774 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
1775 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 1775 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
1776 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 1776 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
1777 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 1777 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
1778 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 1778 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
1779 | 1779 | ||
1780 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 1780 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
1781 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 1781 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
1782 | 1782 | ||
1783 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 1783 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
1784 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 1784 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
1785 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 1785 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
1786 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 1786 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
1787 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 1787 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
1788 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 1788 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
1789 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 1789 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
1790 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 1790 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
1791 | 1791 | ||
1792 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 1792 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
1793 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 1793 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
1794 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 1794 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
1795 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 1795 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
1796 | // | 1796 | // |
1797 | 1797 | ||
1798 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1798 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1799 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 1799 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
@@ -2253,97 +2253,97 @@ void SIMpad::init ( ) | |||
2253 | f. close ( ); | 2253 | f. close ( ); |
2254 | } else { | 2254 | } else { |
2255 | f. setName ( "/etc/oz_version" ); | 2255 | f. setName ( "/etc/oz_version" ); |
2256 | 2256 | ||
2257 | if ( f. open ( IO_ReadOnly )) { | 2257 | if ( f. open ( IO_ReadOnly )) { |
2258 | d-> m_systemstr = "OpenEmbedded/SIMpad"; | 2258 | d-> m_systemstr = "OpenEmbedded/SIMpad"; |
2259 | d-> m_system = System_OpenZaurus; | 2259 | d-> m_system = System_OpenZaurus; |
2260 | 2260 | ||
2261 | QTextStream ts ( &f ); | 2261 | QTextStream ts ( &f ); |
2262 | ts.setDevice ( &f ); | 2262 | ts.setDevice ( &f ); |
2263 | d-> m_sysverstr = ts. readLine ( ); | 2263 | d-> m_sysverstr = ts. readLine ( ); |
2264 | f. close ( ); | 2264 | f. close ( ); |
2265 | } | 2265 | } |
2266 | } | 2266 | } |
2267 | 2267 | ||
2268 | m_leds [0] = m_leds [1] = Led_Off; | 2268 | m_leds [0] = m_leds [1] = Led_Off; |
2269 | 2269 | ||
2270 | m_power_timer = 0; | 2270 | m_power_timer = 0; |
2271 | 2271 | ||
2272 | } | 2272 | } |
2273 | 2273 | ||
2274 | void SIMpad::initButtons ( ) | 2274 | void SIMpad::initButtons ( ) |
2275 | { | 2275 | { |
2276 | if ( d-> m_buttons ) | 2276 | if ( d-> m_buttons ) |
2277 | return; | 2277 | return; |
2278 | 2278 | ||
2279 | if ( isQWS( ) ) | 2279 | if ( isQWS( ) ) |
2280 | QWSServer::setKeyboardFilter ( this ); | 2280 | QWSServer::setKeyboardFilter ( this ); |
2281 | 2281 | ||
2282 | d-> m_buttons = new QValueList <ODeviceButton>; | 2282 | d-> m_buttons = new QValueList <ODeviceButton>; |
2283 | 2283 | ||
2284 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { | 2284 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { |
2285 | s_button *sb = simpad_buttons + i; | 2285 | s_button *sb = simpad_buttons + i; |
2286 | ODeviceButton b; | 2286 | ODeviceButton b; |
2287 | 2287 | ||
2288 | if (( sb-> model & d-> m_model ) == d-> m_model ) { | 2288 | if (( sb-> model & d-> m_model ) == d-> m_model ) { |
2289 | b. setKeycode ( sb-> code ); | 2289 | b. setKeycode ( sb-> code ); |
2290 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); | 2290 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); |
2291 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); | 2291 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); |
2292 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); | 2292 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); |
2293 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); | 2293 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); |
2294 | 2294 | ||
2295 | d-> m_buttons-> append ( b ); | 2295 | d-> m_buttons-> append ( b ); |
2296 | } | 2296 | } |
2297 | } | 2297 | } |
2298 | reloadButtonMapping ( ); | 2298 | reloadButtonMapping ( ); |
2299 | 2299 | ||
2300 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 2300 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
2301 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 2301 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
2302 | } | 2302 | } |
2303 | 2303 | ||
2304 | // SIMpad boardcontrol register CS3 | 2304 | // SIMpad boardcontrol register CS3 |
2305 | #define SIMPAD_BOARDCONTROL "/proc/cs3" | 2305 | #define SIMPAD_BOARDCONTROL "/proc/cs3" |
2306 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA | 2306 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA |
2307 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA | 2307 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA |
2308 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's | 2308 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's |
2309 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V | 2309 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V |
2310 | #define SIMPAD_DISPLAY_ON 0x0010 | 2310 | #define SIMPAD_DISPLAY_ON 0x0010 |
2311 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 | 2311 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 |
2312 | #define SIMPAD_MQ_RESET 0x0040 | 2312 | #define SIMPAD_MQ_RESET 0x0040 |
2313 | #define SIMPAD_PCMCIA_RESET 0x0080 | 2313 | #define SIMPAD_PCMCIA_RESET 0x0080 |
2314 | #define SIMPAD_DECT_POWER_ON 0x0100 | 2314 | #define SIMPAD_DECT_POWER_ON 0x0100 |
2315 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave | 2315 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave |
2316 | #define SIMPAD_RS232_ON 0x0400 | 2316 | #define SIMPAD_RS232_ON 0x0400 |
2317 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave | 2317 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave |
2318 | #define SIMPAD_LED2_ON 0x1000 | 2318 | #define SIMPAD_LED2_ON 0x1000 |
2319 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode | 2319 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode |
2320 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit | 2320 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit |
2321 | #define SIMPAD_RESET_SIMCARD 0x8000 | 2321 | #define SIMPAD_RESET_SIMCARD 0x8000 |
2322 | 2322 | ||
2323 | //SIMpad touchscreen backlight strength control | 2323 | //SIMpad touchscreen backlight strength control |
2324 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" | 2324 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" |
2325 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 | 2325 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 |
2326 | 2326 | ||
2327 | QValueList <OLed> SIMpad::ledList ( ) const | 2327 | QValueList <OLed> SIMpad::ledList ( ) const |
2328 | { | 2328 | { |
2329 | QValueList <OLed> vl; | 2329 | QValueList <OLed> vl; |
2330 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? | 2330 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? |
2331 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway | 2331 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway |
2332 | return vl; | 2332 | return vl; |
2333 | } | 2333 | } |
2334 | 2334 | ||
2335 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const | 2335 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const |
2336 | { | 2336 | { |
2337 | QValueList <OLedState> vl; | 2337 | QValueList <OLedState> vl; |
2338 | 2338 | ||
2339 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? | 2339 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? |
2340 | vl << Led_Off << Led_On; | 2340 | vl << Led_Off << Led_On; |
2341 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway | 2341 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway |
2342 | //vl << Led_Off; | 2342 | //vl << Led_Off; |
2343 | return vl; | 2343 | return vl; |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | OLedState SIMpad::ledState ( OLed l ) const | 2346 | OLedState SIMpad::ledState ( OLed l ) const |
2347 | { | 2347 | { |
2348 | switch ( l ) { | 2348 | switch ( l ) { |
2349 | case Led_Power: | 2349 | case Led_Power: |
@@ -2753,94 +2753,94 @@ bool Jornada::isJornada ( ) | |||
2753 | void Jornada::init ( ) | 2753 | void Jornada::init ( ) |
2754 | { | 2754 | { |
2755 | d-> m_vendorstr = "HP"; | 2755 | d-> m_vendorstr = "HP"; |
2756 | d-> m_vendor = Vendor_HP; | 2756 | d-> m_vendor = Vendor_HP; |
2757 | d-> m_modelstr = "Jornada 56x"; | 2757 | d-> m_modelstr = "Jornada 56x"; |
2758 | d-> m_model = Model_Jornada_56x; | 2758 | d-> m_model = Model_Jornada_56x; |
2759 | d-> m_systemstr = "Familiar"; | 2759 | d-> m_systemstr = "Familiar"; |
2760 | d-> m_system = System_Familiar; | 2760 | d-> m_system = System_Familiar; |
2761 | d-> m_rotation = Rot0; | 2761 | d-> m_rotation = Rot0; |
2762 | 2762 | ||
2763 | QFile f ( "/etc/familiar-version" ); | 2763 | QFile f ( "/etc/familiar-version" ); |
2764 | f. setName ( "/etc/familiar-version" ); | 2764 | f. setName ( "/etc/familiar-version" ); |
2765 | if ( f. open ( IO_ReadOnly )) { | 2765 | if ( f. open ( IO_ReadOnly )) { |
2766 | 2766 | ||
2767 | QTextStream ts ( &f ); | 2767 | QTextStream ts ( &f ); |
2768 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 2768 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
2769 | 2769 | ||
2770 | f. close ( ); | 2770 | f. close ( ); |
2771 | } | 2771 | } |
2772 | } | 2772 | } |
2773 | 2773 | ||
2774 | #if 0 | 2774 | #if 0 |
2775 | void Jornada::initButtons ( ) | 2775 | void Jornada::initButtons ( ) |
2776 | { | 2776 | { |
2777 | if ( d-> m_buttons ) | 2777 | if ( d-> m_buttons ) |
2778 | return; | 2778 | return; |
2779 | 2779 | ||
2780 | // Simulation uses iPAQ 3660 device buttons | 2780 | // Simulation uses iPAQ 3660 device buttons |
2781 | 2781 | ||
2782 | qDebug ( "init Buttons" ); | 2782 | qDebug ( "init Buttons" ); |
2783 | d-> m_buttons = new QValueList <ODeviceButton>; | 2783 | d-> m_buttons = new QValueList <ODeviceButton>; |
2784 | 2784 | ||
2785 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 2785 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
2786 | i_button *ib = ipaq_buttons + i; | 2786 | i_button *ib = ipaq_buttons + i; |
2787 | ODeviceButton b; | 2787 | ODeviceButton b; |
2788 | 2788 | ||
2789 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 2789 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
2790 | b. setKeycode ( ib-> code ); | 2790 | b. setKeycode ( ib-> code ); |
2791 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 2791 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
2792 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 2792 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
2793 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 2793 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
2794 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 2794 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
2795 | d-> m_buttons-> append ( b ); | 2795 | d-> m_buttons-> append ( b ); |
2796 | } | 2796 | } |
2797 | } | 2797 | } |
2798 | reloadButtonMapping ( ); | 2798 | reloadButtonMapping ( ); |
2799 | 2799 | ||
2800 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 2800 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
2801 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 2801 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
2802 | } | 2802 | } |
2803 | #endif | 2803 | #endif |
2804 | int Jornada::displayBrightnessResolution ( ) const | 2804 | int Jornada::displayBrightnessResolution ( ) const |
2805 | { | 2805 | { |
2806 | } | 2806 | } |
2807 | 2807 | ||
2808 | bool Jornada::setDisplayBrightness ( int bright ) | 2808 | bool Jornada::setDisplayBrightness ( int bright ) |
2809 | { | 2809 | { |
2810 | bool res = false; | 2810 | bool res = false; |
2811 | int fd; | 2811 | int fd; |
2812 | 2812 | ||
2813 | if ( bright > 255 ) | 2813 | if ( bright > 255 ) |
2814 | bright = 255; | 2814 | bright = 255; |
2815 | if ( bright < 0 ) | 2815 | if ( bright < 0 ) |
2816 | bright = 0; | 2816 | bright = 0; |
2817 | 2817 | ||
2818 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 2818 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
2819 | FLITE_IN bl; | 2819 | FLITE_IN bl; |
2820 | bl. mode = 1; | 2820 | bl. mode = 1; |
2821 | bl. pwr = bright ? 1 : 0; | 2821 | bl. pwr = bright ? 1 : 0; |
2822 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | 2822 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; |
2823 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 2823 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
2824 | ::close ( fd ); | 2824 | ::close ( fd ); |
2825 | } | 2825 | } |
2826 | return res; | 2826 | return res; |
2827 | } | 2827 | } |
2828 | 2828 | ||
2829 | bool Jornada::setSoftSuspend ( bool soft ) | 2829 | bool Jornada::setSoftSuspend ( bool soft ) |
2830 | { | 2830 | { |
2831 | bool res = false; | 2831 | bool res = false; |
2832 | int fd; | 2832 | int fd; |
2833 | 2833 | ||
2834 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 2834 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
2835 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 2835 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
2836 | res = true; | 2836 | res = true; |
2837 | else | 2837 | else |
2838 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 2838 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
2839 | 2839 | ||
2840 | ::close ( fd ); | 2840 | ::close ( fd ); |
2841 | } | 2841 | } |
2842 | else | 2842 | else |
2843 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 2843 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
2844 | 2844 | ||
2845 | return res; | 2845 | return res; |
2846 | } | 2846 | } |
diff --git a/libopie/ofileselector.cpp b/libopie/ofileselector.cpp index 1ba94ae..2a6aed0 100644 --- a/libopie/ofileselector.cpp +++ b/libopie/ofileselector.cpp | |||
@@ -78,102 +78,102 @@ QString OFileViewInterface::startDirectory()const{ | |||
78 | return selector()->m_startDir; | 78 | return selector()->m_startDir; |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) | 82 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) |
83 | : OFileViewInterface( selector ) { | 83 | : OFileViewInterface( selector ) { |
84 | m_selector = 0; | 84 | m_selector = 0; |
85 | setName( QObject::tr("Documents") ); | 85 | setName( QObject::tr("Documents") ); |
86 | } | 86 | } |
87 | ODocumentFileView::~ODocumentFileView() { | 87 | ODocumentFileView::~ODocumentFileView() { |
88 | 88 | ||
89 | } | 89 | } |
90 | QString ODocumentFileView::selectedName()const { | 90 | QString ODocumentFileView::selectedName()const { |
91 | if (!m_selector) | 91 | if (!m_selector) |
92 | return QString::null; | 92 | return QString::null; |
93 | 93 | ||
94 | return m_selector->selectedDocument().file(); | 94 | return m_selector->selectedDocument().file(); |
95 | } | 95 | } |
96 | QString ODocumentFileView::selectedPath()const { | 96 | QString ODocumentFileView::selectedPath()const { |
97 | return QPEApplication::documentDir(); | 97 | return QPEApplication::documentDir(); |
98 | } | 98 | } |
99 | QString ODocumentFileView::directory()const { | 99 | QString ODocumentFileView::directory()const { |
100 | return selectedPath(); | 100 | return selectedPath(); |
101 | } | 101 | } |
102 | void ODocumentFileView::reread() { | 102 | void ODocumentFileView::reread() { |
103 | if (!m_selector) | 103 | if (!m_selector) |
104 | return; | 104 | return; |
105 | 105 | ||
106 | m_selector->setNewVisible( showNew() ); | 106 | m_selector->setNewVisible( showNew() ); |
107 | m_selector->setCloseVisible( showClose() ); | 107 | m_selector->setCloseVisible( showClose() ); |
108 | m_selector->filter = currentMimeType().join(";"); | 108 | m_selector->filter = currentMimeType().join(";"); |
109 | m_selector->reread(); | 109 | m_selector->reread(); |
110 | } | 110 | } |
111 | int ODocumentFileView::fileCount()const { | 111 | int ODocumentFileView::fileCount()const { |
112 | if (!m_selector) | 112 | if (!m_selector) |
113 | return -1; | 113 | return -1; |
114 | 114 | ||
115 | return m_selector->fileCount(); | 115 | return m_selector->fileCount(); |
116 | } | 116 | } |
117 | DocLnk ODocumentFileView::selectedDocument()const { | 117 | DocLnk ODocumentFileView::selectedDocument()const { |
118 | if (!m_selector) | 118 | if (!m_selector) |
119 | return DocLnk(); | 119 | return DocLnk(); |
120 | 120 | ||
121 | return m_selector->selectedDocument(); | 121 | return m_selector->selectedDocument(); |
122 | } | 122 | } |
123 | QWidget* ODocumentFileView::widget( QWidget* parent ) { | 123 | QWidget* ODocumentFileView::widget( QWidget* parent ) { |
124 | if (!m_selector ) { | 124 | if (!m_selector ) { |
125 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); | 125 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); |
126 | QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), | 126 | QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), |
127 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); | 127 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); |
128 | QObject::connect(m_selector, SIGNAL(closeMe() ), | 128 | QObject::connect(m_selector, SIGNAL(closeMe() ), |
129 | selector(), SIGNAL(closeMe() ) ); | 129 | selector(), SIGNAL(closeMe() ) ); |
130 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), | 130 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), |
131 | selector(), SIGNAL(newSelected(const DocLnk& ) ) ); | 131 | selector(), SIGNAL(newSelected(const DocLnk&) ) ); |
132 | } | 132 | } |
133 | 133 | ||
134 | return m_selector; | 134 | return m_selector; |
135 | } | 135 | } |
136 | 136 | ||
137 | /* | 137 | /* |
138 | * This is the file system view used | 138 | * This is the file system view used |
139 | * we use a QListView + QListViewItems for it | 139 | * we use a QListView + QListViewItems for it |
140 | */ | 140 | */ |
141 | 141 | ||
142 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 142 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
143 | const QString& path, const QString& date, | 143 | const QString& path, const QString& date, |
144 | const QString& size, const QString& dir, | 144 | const QString& size, const QString& dir, |
145 | bool isLocked, bool isDir ) | 145 | bool isLocked, bool isDir ) |
146 | : QListViewItem( view ) | 146 | : QListViewItem( view ) |
147 | { | 147 | { |
148 | setPixmap(0, pixmap ); | 148 | setPixmap(0, pixmap ); |
149 | setText(1, path ); | 149 | setText(1, path ); |
150 | setText(2, size ); | 150 | setText(2, size ); |
151 | setText(3, date ); | 151 | setText(3, date ); |
152 | m_isDir = isDir; | 152 | m_isDir = isDir; |
153 | m_dir = dir; | 153 | m_dir = dir; |
154 | m_locked = isLocked; | 154 | m_locked = isLocked; |
155 | } | 155 | } |
156 | OFileSelectorItem::~OFileSelectorItem() { | 156 | OFileSelectorItem::~OFileSelectorItem() { |
157 | 157 | ||
158 | } | 158 | } |
159 | bool OFileSelectorItem::isLocked()const { | 159 | bool OFileSelectorItem::isLocked()const { |
160 | return m_locked; | 160 | return m_locked; |
161 | } | 161 | } |
162 | QString OFileSelectorItem::directory()const { | 162 | QString OFileSelectorItem::directory()const { |
163 | return m_dir; | 163 | return m_dir; |
164 | } | 164 | } |
165 | bool OFileSelectorItem::isDir()const { | 165 | bool OFileSelectorItem::isDir()const { |
166 | return m_isDir; | 166 | return m_isDir; |
167 | } | 167 | } |
168 | QString OFileSelectorItem::path()const { | 168 | QString OFileSelectorItem::path()const { |
169 | return text( 1 ); | 169 | return text( 1 ); |
170 | } | 170 | } |
171 | QString OFileSelectorItem::key( int id, bool )const { | 171 | QString OFileSelectorItem::key( int id, bool )const { |
172 | QString ke; | 172 | QString ke; |
173 | if( id == 0 || id == 1 ){ // name | 173 | if( id == 0 || id == 1 ){ // name |
174 | if( m_isDir ){ | 174 | if( m_isDir ){ |
175 | ke.append("0" ); | 175 | ke.append("0" ); |
176 | ke.append( text(1) ); | 176 | ke.append( text(1) ); |
177 | }else{ | 177 | }else{ |
178 | ke.append("1" ); | 178 | ke.append("1" ); |
179 | ke.append( text(1) ); | 179 | ke.append( text(1) ); |
@@ -343,98 +343,98 @@ void OFileViewFileListView::reread( bool all ) { | |||
343 | }else if( info.isDir() ){ | 343 | }else if( info.isDir() ){ |
344 | addDir( fi, TRUE ); | 344 | addDir( fi, TRUE ); |
345 | break; | 345 | break; |
346 | }else if( info.isFile() ){ | 346 | }else if( info.isFile() ){ |
347 | addFile( fi, TRUE ); | 347 | addFile( fi, TRUE ); |
348 | break; | 348 | break; |
349 | }else if( info.isSymLink() ){ | 349 | }else if( info.isSymLink() ){ |
350 | file = info.dirPath(true ) + "/" + info.readLink() ; | 350 | file = info.dirPath(true ) + "/" + info.readLink() ; |
351 | break; | 351 | break; |
352 | }else if( i == 4){ // couldn't resolve symlink add it as symlink | 352 | }else if( i == 4){ // couldn't resolve symlink add it as symlink |
353 | addSymlink( fi ); | 353 | addSymlink( fi ); |
354 | } | 354 | } |
355 | } // off for loop for symlink resolving | 355 | } // off for loop for symlink resolving |
356 | }else if( fi->isDir() ) | 356 | }else if( fi->isDir() ) |
357 | addDir( fi ); | 357 | addDir( fi ); |
358 | else if( fi->isFile() ) | 358 | else if( fi->isFile() ) |
359 | addFile( fi ); | 359 | addFile( fi ); |
360 | 360 | ||
361 | ++it; | 361 | ++it; |
362 | } // of while loop | 362 | } // of while loop |
363 | m_view->sort(); | 363 | m_view->sort(); |
364 | 364 | ||
365 | } | 365 | } |
366 | int OFileViewFileListView::fileCount()const{ | 366 | int OFileViewFileListView::fileCount()const{ |
367 | return m_view->childCount(); | 367 | return m_view->childCount(); |
368 | } | 368 | } |
369 | QString OFileViewFileListView::currentDir()const{ | 369 | QString OFileViewFileListView::currentDir()const{ |
370 | return m_currentDir; | 370 | return m_currentDir; |
371 | } | 371 | } |
372 | OFileSelector* OFileViewFileListView::selector() { | 372 | OFileSelector* OFileViewFileListView::selector() { |
373 | return m_sel; | 373 | return m_sel; |
374 | } | 374 | } |
375 | 375 | ||
376 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { | 376 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { |
377 | if ( e->type() == QEvent::KeyPress ) { | 377 | if ( e->type() == QEvent::KeyPress ) { |
378 | QKeyEvent *k = (QKeyEvent *)e; | 378 | QKeyEvent *k = (QKeyEvent *)e; |
379 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { | 379 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { |
380 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); | 380 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); |
381 | return true; | 381 | return true; |
382 | } | 382 | } |
383 | } | 383 | } |
384 | return false; | 384 | return false; |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
388 | void OFileViewFileListView::connectSlots() { | 388 | void OFileViewFileListView::connectSlots() { |
389 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 389 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
390 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 390 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
391 | connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), | 391 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
392 | this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); | 392 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); |
393 | } | 393 | } |
394 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { | 394 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { |
395 | if (!item) | 395 | if (!item) |
396 | return; | 396 | return; |
397 | #if 0 | 397 | #if 0 |
398 | 398 | ||
399 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 399 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
400 | 400 | ||
401 | if (!sel->isDir() ) { | 401 | if (!sel->isDir() ) { |
402 | selector()->m_lneEdit->setText( sel->text(1) ); | 402 | selector()->m_lneEdit->setText( sel->text(1) ); |
403 | // if in fileselector mode we will emit selected | 403 | // if in fileselector mode we will emit selected |
404 | if ( selector()->mode() == OFileSelector::FileSelector ) { | 404 | if ( selector()->mode() == OFileSelector::FileSelector ) { |
405 | qWarning("slot Current Changed"); | 405 | qWarning("slot Current Changed"); |
406 | QStringList str = QStringList::split("->", sel->text(1) ); | 406 | QStringList str = QStringList::split("->", sel->text(1) ); |
407 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 407 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
408 | emit selector()->fileSelected( path ); | 408 | emit selector()->fileSelected( path ); |
409 | DocLnk lnk( path ); | 409 | DocLnk lnk( path ); |
410 | emit selector()->fileSelected( lnk ); | 410 | emit selector()->fileSelected( lnk ); |
411 | } | 411 | } |
412 | } | 412 | } |
413 | #endif | 413 | #endif |
414 | } | 414 | } |
415 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { | 415 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { |
416 | if (!item || ( button != Qt::LeftButton) ) | 416 | if (!item || ( button != Qt::LeftButton) ) |
417 | return; | 417 | return; |
418 | 418 | ||
419 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 419 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
420 | if (!sel->isLocked() ) { | 420 | if (!sel->isLocked() ) { |
421 | QStringList str = QStringList::split("->", sel->text(1) ); | 421 | QStringList str = QStringList::split("->", sel->text(1) ); |
422 | if (sel->isDir() ) { | 422 | if (sel->isDir() ) { |
423 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | 423 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); |
424 | emit selector()->dirSelected( m_currentDir ); | 424 | emit selector()->dirSelected( m_currentDir ); |
425 | reread( m_all ); | 425 | reread( m_all ); |
426 | }else { // file | 426 | }else { // file |
427 | qWarning("slot Clicked"); | 427 | qWarning("slot Clicked"); |
428 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 428 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
429 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 429 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
430 | emit selector()->fileSelected( path ); | 430 | emit selector()->fileSelected( path ); |
431 | DocLnk lnk( path ); | 431 | DocLnk lnk( path ); |
432 | emit selector()->fileSelected( lnk ); | 432 | emit selector()->fileSelected( lnk ); |
433 | } | 433 | } |
434 | } // not locked | 434 | } // not locked |
435 | } | 435 | } |
436 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { | 436 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { |
437 | MimeType type( info->absFilePath() ); | 437 | MimeType type( info->absFilePath() ); |
438 | if (!compliesMime( type.id() ) ) | 438 | if (!compliesMime( type.id() ) ) |
439 | return; | 439 | return; |
440 | 440 | ||
@@ -735,98 +735,98 @@ void OFileSelector::initUI() { | |||
735 | m_nameBox = new QHBox( this ); | 735 | m_nameBox = new QHBox( this ); |
736 | (void)new QLabel( tr("Name:"), m_nameBox ); | 736 | (void)new QLabel( tr("Name:"), m_nameBox ); |
737 | m_lneEdit = new QLineEdit( m_nameBox ); | 737 | m_lneEdit = new QLineEdit( m_nameBox ); |
738 | m_lneEdit ->installEventFilter(this); | 738 | m_lneEdit ->installEventFilter(this); |
739 | lay->addWidget( m_nameBox ); | 739 | lay->addWidget( m_nameBox ); |
740 | 740 | ||
741 | m_cmbBox = new QHBox( this ); | 741 | m_cmbBox = new QHBox( this ); |
742 | m_cmbView = new QComboBox( m_cmbBox ); | 742 | m_cmbView = new QComboBox( m_cmbBox ); |
743 | m_cmbMime = new QComboBox( m_cmbBox ); | 743 | m_cmbMime = new QComboBox( m_cmbBox ); |
744 | lay->addWidget( m_cmbBox ); | 744 | lay->addWidget( m_cmbBox ); |
745 | } | 745 | } |
746 | 746 | ||
747 | /* | 747 | /* |
748 | * This will make sure that the return key in the name edit causes dialogs to close | 748 | * This will make sure that the return key in the name edit causes dialogs to close |
749 | */ | 749 | */ |
750 | 750 | ||
751 | bool OFileSelector::eventFilter (QObject *o, QEvent *e) { | 751 | bool OFileSelector::eventFilter (QObject *o, QEvent *e) { |
752 | if ( e->type() == QEvent::KeyPress ) { | 752 | if ( e->type() == QEvent::KeyPress ) { |
753 | QKeyEvent *k = (QKeyEvent *)e; | 753 | QKeyEvent *k = (QKeyEvent *)e; |
754 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { | 754 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { |
755 | emit ok(); | 755 | emit ok(); |
756 | return true; | 756 | return true; |
757 | } | 757 | } |
758 | } | 758 | } |
759 | return false; | 759 | return false; |
760 | } | 760 | } |
761 | 761 | ||
762 | /* | 762 | /* |
763 | * This will insert the MimeTypes into the Combo Box | 763 | * This will insert the MimeTypes into the Combo Box |
764 | * And also connect the changed signal | 764 | * And also connect the changed signal |
765 | * | 765 | * |
766 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes | 766 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes |
767 | */ | 767 | */ |
768 | void OFileSelector::initMime() { | 768 | void OFileSelector::initMime() { |
769 | MimeTypes::Iterator it; | 769 | MimeTypes::Iterator it; |
770 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) { | 770 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) { |
771 | m_cmbMime->insertItem( it.key() ); | 771 | m_cmbMime->insertItem( it.key() ); |
772 | } | 772 | } |
773 | m_cmbMime->setCurrentItem( 0 ); | 773 | m_cmbMime->setCurrentItem( 0 ); |
774 | 774 | ||
775 | connect( m_cmbMime, SIGNAL(activated(int) ), | 775 | connect( m_cmbMime, SIGNAL(activated(int) ), |
776 | this, SLOT(slotMimeTypeChanged() ) ); | 776 | this, SLOT(slotMimeTypeChanged() ) ); |
777 | 777 | ||
778 | } | 778 | } |
779 | void OFileSelector::initViews() { | 779 | void OFileSelector::initViews() { |
780 | m_cmbView->insertItem( QObject::tr("Documents") ); | 780 | m_cmbView->insertItem( QObject::tr("Documents") ); |
781 | m_cmbView->insertItem( QObject::tr("Files") ); | 781 | m_cmbView->insertItem( QObject::tr("Files") ); |
782 | m_cmbView->insertItem( QObject::tr("All Files") ); | 782 | m_cmbView->insertItem( QObject::tr("All Files") ); |
783 | connect(m_cmbView, SIGNAL(activated( const QString& ) ), | 783 | connect(m_cmbView, SIGNAL(activated(const QString&) ), |
784 | this, SLOT(slotViewChange( const QString& ) ) ); | 784 | this, SLOT(slotViewChange(const QString&) ) ); |
785 | 785 | ||
786 | 786 | ||
787 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | 787 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); |
788 | 788 | ||
789 | /* see above why add both */ | 789 | /* see above why add both */ |
790 | OFileViewInterface* in = new OFileViewFileSystem( this ); | 790 | OFileViewInterface* in = new OFileViewFileSystem( this ); |
791 | m_views.insert( QObject::tr("Files"), in ); | 791 | m_views.insert( QObject::tr("Files"), in ); |
792 | m_views.insert( QObject::tr("All Files"), in ); | 792 | m_views.insert( QObject::tr("All Files"), in ); |
793 | } | 793 | } |
794 | 794 | ||
795 | /** | 795 | /** |
796 | * d'tor | 796 | * d'tor |
797 | */ | 797 | */ |
798 | OFileSelector::~OFileSelector() { | 798 | OFileSelector::~OFileSelector() { |
799 | 799 | ||
800 | } | 800 | } |
801 | 801 | ||
802 | /** | 802 | /** |
803 | * Convience function for the fileselector | 803 | * Convience function for the fileselector |
804 | * make sure to delete the DocLnk | 804 | * make sure to delete the DocLnk |
805 | * | 805 | * |
806 | * @see DocLnk | 806 | * @see DocLnk |
807 | * @todo remove in ODP | 807 | * @todo remove in ODP |
808 | */ | 808 | */ |
809 | const DocLnk* OFileSelector::selected() { | 809 | const DocLnk* OFileSelector::selected() { |
810 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); | 810 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); |
811 | return lnk; | 811 | return lnk; |
812 | } | 812 | } |
813 | 813 | ||
814 | /** | 814 | /** |
815 | * | 815 | * |
816 | * @return the name of the selected file | 816 | * @return the name of the selected file |
817 | */ | 817 | */ |
818 | QString OFileSelector::selectedName()const{ | 818 | QString OFileSelector::selectedName()const{ |
819 | return currentView()->selectedName(); | 819 | return currentView()->selectedName(); |
820 | } | 820 | } |
821 | 821 | ||
822 | /** | 822 | /** |
823 | * @return the selected path | 823 | * @return the selected path |
824 | */ | 824 | */ |
825 | QString OFileSelector::selectedPath()const { | 825 | QString OFileSelector::selectedPath()const { |
826 | return currentView()->selectedPath(); | 826 | return currentView()->selectedPath(); |
827 | } | 827 | } |
828 | 828 | ||
829 | /** | 829 | /** |
830 | * @return the directory name | 830 | * @return the directory name |
831 | */ | 831 | */ |
832 | QString OFileSelector::directory()const { | 832 | QString OFileSelector::directory()const { |
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp index 7e07008..87b7869 100644 --- a/libopie/ofontselector.cpp +++ b/libopie/ofontselector.cpp | |||
@@ -74,111 +74,111 @@ public: | |||
74 | } | 74 | } |
75 | 75 | ||
76 | const QValueList<int> &sizes ( ) const | 76 | const QValueList<int> &sizes ( ) const |
77 | { | 77 | { |
78 | return m_sizes; | 78 | return m_sizes; |
79 | } | 79 | } |
80 | 80 | ||
81 | private: | 81 | private: |
82 | QStringList m_styles; | 82 | QStringList m_styles; |
83 | QValueList<int> m_sizes; | 83 | QValueList<int> m_sizes; |
84 | QString m_name; | 84 | QString m_name; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | 87 | ||
88 | static int findItemCB ( QComboBox *box, const QString &str ) | 88 | static int findItemCB ( QComboBox *box, const QString &str ) |
89 | { | 89 | { |
90 | for ( int i = 0; i < box-> count ( ); i++ ) { | 90 | for ( int i = 0; i < box-> count ( ); i++ ) { |
91 | if ( box-> text ( i ) == str ) | 91 | if ( box-> text ( i ) == str ) |
92 | return i; | 92 | return i; |
93 | } | 93 | } |
94 | return -1; | 94 | return -1; |
95 | } | 95 | } |
96 | 96 | ||
97 | } | 97 | } |
98 | /* static same as anon. namespace */ | 98 | /* static same as anon. namespace */ |
99 | static int qt_version ( ) | 99 | static int qt_version ( ) |
100 | { | 100 | { |
101 | const char *qver = qVersion ( ); | 101 | const char *qver = qVersion ( ); |
102 | 102 | ||
103 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 103 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
104 | } | 104 | } |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Constructs the Selector object | 107 | * Constructs the Selector object |
108 | * @param withpreview If a font preview should be given | 108 | * @param withpreview If a font preview should be given |
109 | * @param parent The parent of the Font Selector | 109 | * @param parent The parent of the Font Selector |
110 | * @param name The name of the object | 110 | * @param name The name of the object |
111 | * @param fl WidgetFlags | 111 | * @param fl WidgetFlags |
112 | */ | 112 | */ |
113 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 113 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
114 | { | 114 | { |
115 | d = new OFontSelectorPrivate ( ); | 115 | d = new OFontSelectorPrivate ( ); |
116 | 116 | ||
117 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); | 117 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); |
118 | gridLayout->setRowStretch ( 4, 10 ); | 118 | gridLayout->setRowStretch ( 4, 10 ); |
119 | 119 | ||
120 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); | 120 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); |
121 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); | 121 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); |
122 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); | 122 | connect( d-> m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) ); |
123 | 123 | ||
124 | QLabel *label = new QLabel( tr( "Style" ), this ); | 124 | QLabel *label = new QLabel( tr( "Style" ), this ); |
125 | gridLayout->addWidget( label, 0, 1 ); | 125 | gridLayout->addWidget( label, 0, 1 ); |
126 | 126 | ||
127 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); | 127 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); |
128 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); | 128 | connect( d-> m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) ); |
129 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); | 129 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); |
130 | 130 | ||
131 | label = new QLabel( tr( "Size" ), this ); | 131 | label = new QLabel( tr( "Size" ), this ); |
132 | gridLayout->addWidget( label, 2, 1 ); | 132 | gridLayout->addWidget( label, 2, 1 ); |
133 | 133 | ||
134 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); | 134 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); |
135 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), | 135 | connect( d-> m_font_size_list, SIGNAL( activated(int) ), |
136 | this, SLOT( fontSizeClicked( int ) ) ); | 136 | this, SLOT( fontSizeClicked(int) ) ); |
137 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); | 137 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); |
138 | 138 | ||
139 | d-> m_pointbug = ( qt_version ( ) <= 233 ); | 139 | d-> m_pointbug = ( qt_version ( ) <= 233 ); |
140 | 140 | ||
141 | if ( withpreview ) { | 141 | if ( withpreview ) { |
142 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); | 142 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); |
143 | d-> m_preview-> setAlignment ( AlignCenter ); | 143 | d-> m_preview-> setAlignment ( AlignCenter ); |
144 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); | 144 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); |
145 | d-> m_preview-> setMargin ( 3 ); | 145 | d-> m_preview-> setMargin ( 3 ); |
146 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); | 146 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); |
147 | gridLayout-> addRowSpacing ( 5, 4 ); | 147 | gridLayout-> addRowSpacing ( 5, 4 ); |
148 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); | 148 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); |
149 | gridLayout-> setRowStretch ( 6, 5 ); | 149 | gridLayout-> setRowStretch ( 6, 5 ); |
150 | } | 150 | } |
151 | else | 151 | else |
152 | d-> m_preview = 0; | 152 | d-> m_preview = 0; |
153 | 153 | ||
154 | loadFonts ( d-> m_font_family_list ); | 154 | loadFonts ( d-> m_font_family_list ); |
155 | } | 155 | } |
156 | 156 | ||
157 | OFontSelector::~OFontSelector ( ) | 157 | OFontSelector::~OFontSelector ( ) |
158 | { | 158 | { |
159 | delete d; | 159 | delete d; |
160 | } | 160 | } |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * This methods tries to set the font | 163 | * This methods tries to set the font |
164 | * @param f The wishes font | 164 | * @param f The wishes font |
165 | * @return success or failure | 165 | * @return success or failure |
166 | */ | 166 | */ |
167 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 167 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
168 | { | 168 | { |
169 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); | 169 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | /** | 173 | /** |
174 | * This is an overloaded method @see setSelectedFont | 174 | * This is an overloaded method @see setSelectedFont |
175 | * @param familyStr The family of the font | 175 | * @param familyStr The family of the font |
176 | * @param styleStr The style of the font | 176 | * @param styleStr The style of the font |
177 | * @param sizeVal The size of font | 177 | * @param sizeVal The size of font |
178 | * @param charset The charset to be used. Will be deprecated by QT3 | 178 | * @param charset The charset to be used. Will be deprecated by QT3 |
179 | */ | 179 | */ |
180 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | 180 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) |
181 | { | 181 | { |
182 | QString sizeStr = QString::number ( sizeVal ); | 182 | QString sizeStr = QString::number ( sizeVal ); |
183 | 183 | ||
184 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); | 184 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); |
diff --git a/libopie/orecurrancewidget.cpp b/libopie/orecurrancewidget.cpp index d81851e..33be269 100644 --- a/libopie/orecurrancewidget.cpp +++ b/libopie/orecurrancewidget.cpp | |||
@@ -505,98 +505,98 @@ void ORecurranceWidget::setupWeekly() { | |||
505 | // might as well set the day too... | 505 | // might as well set the day too... |
506 | if ( startWeekOnMonday ) { | 506 | if ( startWeekOnMonday ) { |
507 | fraExtra->setButton( start.dayOfWeek() - 1 ); | 507 | fraExtra->setButton( start.dayOfWeek() - 1 ); |
508 | } else { | 508 | } else { |
509 | fraExtra->setButton( start.dayOfWeek() % 7 ); | 509 | fraExtra->setButton( start.dayOfWeek() % 7 ); |
510 | } | 510 | } |
511 | lblFreq->setText( tr("week(s)") ); | 511 | lblFreq->setText( tr("week(s)") ); |
512 | lblVar2->show(); | 512 | lblVar2->show(); |
513 | showRepeatStuff(); | 513 | showRepeatStuff(); |
514 | setupRepeatLabel( 1 ); | 514 | setupRepeatLabel( 1 ); |
515 | } | 515 | } |
516 | void ORecurranceWidget::setupMonthly() { | 516 | void ORecurranceWidget::setupMonthly() { |
517 | hideExtras(); | 517 | hideExtras(); |
518 | lblWeekVar->hide(); | 518 | lblWeekVar->hide(); |
519 | fraExtra->setTitle( tr("Repeat By") ); | 519 | fraExtra->setTitle( tr("Repeat By") ); |
520 | fraExtra->setExclusive( TRUE ); | 520 | fraExtra->setExclusive( TRUE ); |
521 | fraExtra->show(); | 521 | fraExtra->show(); |
522 | cmdExtra1->setText( tr("Day") ); | 522 | cmdExtra1->setText( tr("Day") ); |
523 | cmdExtra1->show(); | 523 | cmdExtra1->show(); |
524 | cmdExtra2->setText( tr("Date") ); | 524 | cmdExtra2->setText( tr("Date") ); |
525 | cmdExtra2->show(); | 525 | cmdExtra2->show(); |
526 | spinFreq->setValue( 1 ); | 526 | spinFreq->setValue( 1 ); |
527 | lblFreq->setText( tr("month(s)") ); | 527 | lblFreq->setText( tr("month(s)") ); |
528 | lblVar2->show(); | 528 | lblVar2->show(); |
529 | showRepeatStuff(); | 529 | showRepeatStuff(); |
530 | setupRepeatLabel( 1 ); | 530 | setupRepeatLabel( 1 ); |
531 | } | 531 | } |
532 | void ORecurranceWidget::setupYearly() { | 532 | void ORecurranceWidget::setupYearly() { |
533 | hideExtras(); | 533 | hideExtras(); |
534 | lblWeekVar->hide(); | 534 | lblWeekVar->hide(); |
535 | spinFreq->setValue( 1 ); | 535 | spinFreq->setValue( 1 ); |
536 | lblFreq->setText( tr("year(s)") ); | 536 | lblFreq->setText( tr("year(s)") ); |
537 | lblFreq->show(); | 537 | lblFreq->show(); |
538 | lblFreq->show(); | 538 | lblFreq->show(); |
539 | showRepeatStuff(); | 539 | showRepeatStuff(); |
540 | lblVar2->show(); | 540 | lblVar2->show(); |
541 | QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); | 541 | QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); |
542 | lblRepeat->setText( strEvery ); | 542 | lblRepeat->setText( strEvery ); |
543 | setupRepeatLabel( 1 ); | 543 | setupRepeatLabel( 1 ); |
544 | 544 | ||
545 | } | 545 | } |
546 | void ORecurranceWidget::init() { | 546 | void ORecurranceWidget::init() { |
547 | QPopupMenu *m1 = new QPopupMenu( this ); | 547 | QPopupMenu *m1 = new QPopupMenu( this ); |
548 | repeatPicker = new DateBookMonth( m1, 0, TRUE ); | 548 | repeatPicker = new DateBookMonth( m1, 0, TRUE ); |
549 | m1->insertItem( repeatPicker ); | 549 | m1->insertItem( repeatPicker ); |
550 | cmdEnd->setPopup( m1 ); | 550 | cmdEnd->setPopup( m1 ); |
551 | cmdEnd->setPopupDelay( 0 ); | 551 | cmdEnd->setPopupDelay( 0 ); |
552 | 552 | ||
553 | QObject::connect( repeatPicker, SIGNAL(dateClicked(int, int, int)), | 553 | QObject::connect( repeatPicker, SIGNAL(dateClicked(int,int,int)), |
554 | this, SLOT(endDateChanged(int, int, int)) ); | 554 | this, SLOT(endDateChanged(int,int,int)) ); |
555 | QObject::connect( qApp, SIGNAL(weekChanged(bool)), | 555 | QObject::connect( qApp, SIGNAL(weekChanged(bool)), |
556 | this, SLOT(slotChangeStartOfWeek(bool)) ); | 556 | this, SLOT(slotChangeStartOfWeek(bool)) ); |
557 | 557 | ||
558 | listRTypeButtons.setAutoDelete( TRUE ); | 558 | listRTypeButtons.setAutoDelete( TRUE ); |
559 | listRTypeButtons.append( cmdNone ); | 559 | listRTypeButtons.append( cmdNone ); |
560 | listRTypeButtons.append( cmdDay ); | 560 | listRTypeButtons.append( cmdDay ); |
561 | listRTypeButtons.append( cmdWeek ); | 561 | listRTypeButtons.append( cmdWeek ); |
562 | listRTypeButtons.append( cmdMonth ); | 562 | listRTypeButtons.append( cmdMonth ); |
563 | listRTypeButtons.append( cmdYear ); | 563 | listRTypeButtons.append( cmdYear ); |
564 | 564 | ||
565 | listExtra.setAutoDelete( TRUE ); | 565 | listExtra.setAutoDelete( TRUE ); |
566 | listExtra.append( cmdExtra1 ); | 566 | listExtra.append( cmdExtra1 ); |
567 | listExtra.append( cmdExtra2 ); | 567 | listExtra.append( cmdExtra2 ); |
568 | listExtra.append( cmdExtra3 ); | 568 | listExtra.append( cmdExtra3 ); |
569 | listExtra.append( cmdExtra4 ); | 569 | listExtra.append( cmdExtra4 ); |
570 | listExtra.append( cmdExtra5 ); | 570 | listExtra.append( cmdExtra5 ); |
571 | listExtra.append( cmdExtra6 ); | 571 | listExtra.append( cmdExtra6 ); |
572 | listExtra.append( cmdExtra7 ); | 572 | listExtra.append( cmdExtra7 ); |
573 | } | 573 | } |
574 | void ORecurranceWidget::hideExtras() { | 574 | void ORecurranceWidget::hideExtras() { |
575 | // hide the extra buttons... | 575 | // hide the extra buttons... |
576 | fraExtra->hide(); | 576 | fraExtra->hide(); |
577 | chkNoEnd->hide(); | 577 | chkNoEnd->hide(); |
578 | QListIterator<QToolButton> it( listExtra ); | 578 | QListIterator<QToolButton> it( listExtra ); |
579 | for ( ; *it; ++it ) { | 579 | for ( ; *it; ++it ) { |
580 | (*it)->hide(); | 580 | (*it)->hide(); |
581 | (*it)->setOn( FALSE ); | 581 | (*it)->setOn( FALSE ); |
582 | } | 582 | } |
583 | } | 583 | } |
584 | void ORecurranceWidget::showRepeatStuff() { | 584 | void ORecurranceWidget::showRepeatStuff() { |
585 | cmdEnd->show(); | 585 | cmdEnd->show(); |
586 | chkNoEnd->show(); | 586 | chkNoEnd->show(); |
587 | lblFreq->show(); | 587 | lblFreq->show(); |
588 | lblEvery->show(); | 588 | lblEvery->show(); |
589 | lblFreq->show(); | 589 | lblFreq->show(); |
590 | spinFreq->show(); | 590 | spinFreq->show(); |
591 | lblEnd->show(); | 591 | lblEnd->show(); |
592 | lblRepeat->setText( tr("Every") ); | 592 | lblRepeat->setText( tr("Every") ); |
593 | } | 593 | } |
594 | 594 | ||
595 | 595 | ||
596 | static int week( const QDate &start ) | 596 | static int week( const QDate &start ) |
597 | { | 597 | { |
598 | // figure out the week... | 598 | // figure out the week... |
599 | int stop = start.day(), | 599 | int stop = start.day(), |
600 | sentinel = start.dayOfWeek(), | 600 | sentinel = start.dayOfWeek(), |
601 | dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(), | 601 | dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(), |
602 | week = 1, | 602 | week = 1, |
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index 3a9a5ec..52190b2 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp | |||
@@ -25,101 +25,101 @@ | |||
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "otabwidget.h" | 32 | #include "otabwidget.h" |
33 | 33 | ||
34 | #include <qpe/applnk.h> | 34 | #include <qpe/applnk.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <opie/otabbar.h> | 37 | #include <opie/otabbar.h> |
38 | 38 | ||
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qwidgetstack.h> | 40 | #include <qwidgetstack.h> |
41 | 41 | ||
42 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) | 42 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) |
43 | : QWidget( parent, name ) | 43 | : QWidget( parent, name ) |
44 | { | 44 | { |
45 | if ( s == Global ) | 45 | if ( s == Global ) |
46 | { | 46 | { |
47 | Config config( "qpe" ); | 47 | Config config( "qpe" ); |
48 | config.setGroup( "Appearance" ); | 48 | config.setGroup( "Appearance" ); |
49 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); | 49 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); |
50 | if ( s <= Global || s > IconList) | 50 | if ( s <= Global || s > IconList) |
51 | { | 51 | { |
52 | s = IconTab; | 52 | s = IconTab; |
53 | } | 53 | } |
54 | QString pos = config.readEntry( "TabPosition", "Top"); | 54 | QString pos = config.readEntry( "TabPosition", "Top"); |
55 | if ( pos == "Bottom" ) | 55 | if ( pos == "Bottom" ) |
56 | { | 56 | { |
57 | p = Bottom; | 57 | p = Bottom; |
58 | } | 58 | } |
59 | else | 59 | else |
60 | { | 60 | { |
61 | p = Top; | 61 | p = Top; |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | widgetStack = new QWidgetStack( this, "widgetstack" ); | 65 | widgetStack = new QWidgetStack( this, "widgetstack" ); |
66 | widgetStack->setFrameStyle( QFrame::NoFrame ); | 66 | widgetStack->setFrameStyle( QFrame::NoFrame ); |
67 | widgetStack->setLineWidth( style().defaultFrameWidth() ); | 67 | widgetStack->setLineWidth( style().defaultFrameWidth() ); |
68 | 68 | ||
69 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); | 69 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); |
70 | 70 | ||
71 | tabBar = new OTabBar( tabBarStack, "tabbar" ); | 71 | tabBar = new OTabBar( tabBarStack, "tabbar" ); |
72 | tabBarStack->addWidget( tabBar, 0 ); | 72 | tabBarStack->addWidget( tabBar, 0 ); |
73 | connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); | 73 | connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) ); |
74 | 74 | ||
75 | tabList = new QComboBox( false, tabBarStack, "tablist" ); | 75 | tabList = new QComboBox( false, tabBarStack, "tablist" ); |
76 | tabBarStack->addWidget( tabList, 1 ); | 76 | tabBarStack->addWidget( tabList, 1 ); |
77 | connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); | 77 | connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) ); |
78 | 78 | ||
79 | tabBarPosition = p; | 79 | tabBarPosition = p; |
80 | setTabStyle( s ); | 80 | setTabStyle( s ); |
81 | setTabPosition( p ); | 81 | setTabPosition( p ); |
82 | 82 | ||
83 | currTab= 0x0; | 83 | currTab= 0x0; |
84 | } | 84 | } |
85 | 85 | ||
86 | OTabWidget::~OTabWidget() | 86 | OTabWidget::~OTabWidget() |
87 | { | 87 | { |
88 | } | 88 | } |
89 | 89 | ||
90 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) | 90 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) |
91 | { | 91 | { |
92 | QPixmap iconset = loadSmooth( icon ); | 92 | QPixmap iconset = loadSmooth( icon ); |
93 | 93 | ||
94 | QTab *tab = new QTab(); | 94 | QTab *tab = new QTab(); |
95 | if ( tabBarStyle == IconTab ) | 95 | if ( tabBarStyle == IconTab ) |
96 | { | 96 | { |
97 | tab->label = QString::null; | 97 | tab->label = QString::null; |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | tab->label = label; | 101 | tab->label = label; |
102 | } | 102 | } |
103 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 103 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
104 | { | 104 | { |
105 | tab->iconset = new QIconSet( iconset ); | 105 | tab->iconset = new QIconSet( iconset ); |
106 | } | 106 | } |
107 | int tabid = tabBar->addTab( tab ); | 107 | int tabid = tabBar->addTab( tab ); |
108 | 108 | ||
109 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 109 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
110 | { | 110 | { |
111 | tabList->insertItem( iconset, label, -1 ); | 111 | tabList->insertItem( iconset, label, -1 ); |
112 | } | 112 | } |
113 | else | 113 | else |
114 | { | 114 | { |
115 | tabList->insertItem( label ); | 115 | tabList->insertItem( label ); |
116 | } | 116 | } |
117 | 117 | ||
118 | widgetStack->addWidget( child, tabid ); | 118 | widgetStack->addWidget( child, tabid ); |
119 | widgetStack->raiseWidget( child ); | 119 | widgetStack->raiseWidget( child ); |
120 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); | 120 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); |
121 | 121 | ||
122 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); | 122 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); |
123 | tabs.append( tabinfo ); | 123 | tabs.append( tabinfo ); |
124 | selectTab( tabinfo ); | 124 | selectTab( tabinfo ); |
125 | } | 125 | } |
diff --git a/libopie/otimepicker.cpp b/libopie/otimepicker.cpp index 1eca7c5..11b80ed 100644 --- a/libopie/otimepicker.cpp +++ b/libopie/otimepicker.cpp | |||
@@ -128,102 +128,102 @@ void OTimePicker::setTime( int h, int m ) { | |||
128 | * FIXME round minutes to the 5 minute arrangement -zecke | 128 | * FIXME round minutes to the 5 minute arrangement -zecke |
129 | */ | 129 | */ |
130 | /** | 130 | /** |
131 | * Method to set the minutes | 131 | * Method to set the minutes |
132 | * @param m minutes | 132 | * @param m minutes |
133 | */ | 133 | */ |
134 | void OTimePicker::setMinute(int m) { | 134 | void OTimePicker::setMinute(int m) { |
135 | 135 | ||
136 | QString minute; | 136 | QString minute; |
137 | minute.sprintf("%.2d",m); | 137 | minute.sprintf("%.2d",m); |
138 | 138 | ||
139 | QValueListIterator<OClickableLabel *> it; | 139 | QValueListIterator<OClickableLabel *> it; |
140 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { | 140 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { |
141 | if ((*it)->text() == minute) (*it)->setOn(true); | 141 | if ((*it)->text() == minute) (*it)->setOn(true); |
142 | else (*it)->setOn(false); | 142 | else (*it)->setOn(false); |
143 | } | 143 | } |
144 | 144 | ||
145 | tm.setHMS(tm.hour(),m,0); | 145 | tm.setHMS(tm.hour(),m,0); |
146 | } | 146 | } |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * Method to set the hour | 149 | * Method to set the hour |
150 | */ | 150 | */ |
151 | void OTimePicker::setHour(int h) { | 151 | void OTimePicker::setHour(int h) { |
152 | 152 | ||
153 | QString hour; | 153 | QString hour; |
154 | hour.sprintf("%.2d",h); | 154 | hour.sprintf("%.2d",h); |
155 | 155 | ||
156 | QValueListIterator<OClickableLabel *> it; | 156 | QValueListIterator<OClickableLabel *> it; |
157 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { | 157 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { |
158 | if ((*it)->text() == hour) (*it)->setOn(true); | 158 | if ((*it)->text() == hour) (*it)->setOn(true); |
159 | else (*it)->setOn(false); | 159 | else (*it)->setOn(false); |
160 | } | 160 | } |
161 | tm.setHMS(h,tm.minute(),0); | 161 | tm.setHMS(h,tm.minute(),0); |
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | /** | 165 | /** |
166 | * This is a modal Dialog. | 166 | * This is a modal Dialog. |
167 | * | 167 | * |
168 | * @param parent The parent widget | 168 | * @param parent The parent widget |
169 | * @param name The name of the object | 169 | * @param name The name of the object |
170 | * @param fl Possible window flags | 170 | * @param fl Possible window flags |
171 | */ | 171 | */ |
172 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) | 172 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) |
173 | : OTimePickerDialogBase (parent , name, true , fl) | 173 | : OTimePickerDialogBase (parent , name, true , fl) |
174 | { | 174 | { |
175 | 175 | ||
176 | connect ( m_timePicker, SIGNAL( timeChanged( const QTime& ) ), | 176 | connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ), |
177 | this, SLOT( setTime ( const QTime& ) ) ); | 177 | this, SLOT( setTime(const QTime&) ) ); |
178 | connect ( minuteField, SIGNAL( textChanged ( const QString& ) ), | 178 | connect ( minuteField, SIGNAL( textChanged(const QString&) ), |
179 | this, SLOT ( setMinute ( const QString& ) ) ); | 179 | this, SLOT ( setMinute(const QString&) ) ); |
180 | connect ( hourField, SIGNAL( textChanged ( const QString& ) ), | 180 | connect ( hourField, SIGNAL( textChanged(const QString&) ), |
181 | this, SLOT ( setHour ( const QString& ) ) ); | 181 | this, SLOT ( setHour(const QString&) ) ); |
182 | 182 | ||
183 | } | 183 | } |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * @return the time | 186 | * @return the time |
187 | */ | 187 | */ |
188 | QTime OTimePickerDialog::time()const | 188 | QTime OTimePickerDialog::time()const |
189 | { | 189 | { |
190 | return m_time; | 190 | return m_time; |
191 | } | 191 | } |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Set the time to time | 194 | * Set the time to time |
195 | * @param time The time to be set | 195 | * @param time The time to be set |
196 | */ | 196 | */ |
197 | void OTimePickerDialog::setTime( const QTime& time ) | 197 | void OTimePickerDialog::setTime( const QTime& time ) |
198 | { | 198 | { |
199 | m_time = time; | 199 | m_time = time; |
200 | 200 | ||
201 | m_timePicker->setHour ( time.hour() ); | 201 | m_timePicker->setHour ( time.hour() ); |
202 | m_timePicker->setMinute( time.minute() ); | 202 | m_timePicker->setMinute( time.minute() ); |
203 | 203 | ||
204 | // Set Textfields | 204 | // Set Textfields |
205 | if ( time.hour() < 10 ) | 205 | if ( time.hour() < 10 ) |
206 | hourField->setText( "0" + QString::number( time.hour() ) ); | 206 | hourField->setText( "0" + QString::number( time.hour() ) ); |
207 | else | 207 | else |
208 | hourField->setText( QString::number( time.hour() ) ); | 208 | hourField->setText( QString::number( time.hour() ) ); |
209 | 209 | ||
210 | if ( time.minute() < 10 ) | 210 | if ( time.minute() < 10 ) |
211 | minuteField->setText( "0" + QString::number( time.minute() ) ); | 211 | minuteField->setText( "0" + QString::number( time.minute() ) ); |
212 | else | 212 | else |
213 | minuteField->setText( QString::number( time.minute() ) ); | 213 | minuteField->setText( QString::number( time.minute() ) ); |
214 | 214 | ||
215 | } | 215 | } |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * This method takes the current minute and tries to set hour | 218 | * This method takes the current minute and tries to set hour |
219 | * to hour. This succeeds if the resulting date is valid | 219 | * to hour. This succeeds if the resulting date is valid |
220 | * @param hour The hour as a string | 220 | * @param hour The hour as a string |
221 | */ | 221 | */ |
222 | void OTimePickerDialog::setHour ( const QString& hour ) | 222 | void OTimePickerDialog::setHour ( const QString& hour ) |
223 | { | 223 | { |
224 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){ | 224 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){ |
225 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); | 225 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); |
226 | setTime ( m_time ); | 226 | setTime ( m_time ); |
227 | } | 227 | } |
228 | 228 | ||
229 | } | 229 | } |
diff --git a/libopie/pim/ocontactaccess.cpp b/libopie/pim/ocontactaccess.cpp index 2e3ec1f..bc359f7 100644 --- a/libopie/pim/ocontactaccess.cpp +++ b/libopie/pim/ocontactaccess.cpp | |||
@@ -1,147 +1,152 @@ | |||
1 | /* | 1 | /* |
2 | * Class to manage the Contacts. | 2 | * Class to manage the Contacts. |
3 | * | 3 | * |
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | 4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) |
5 | * | 5 | * |
6 | * ===================================================================== | 6 | * ===================================================================== |
7 | *This program is free software; you can redistribute it and/or | 7 | *This program is free software; you can redistribute it and/or |
8 | *modify it under the terms of the GNU Library General Public | 8 | *modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * Info: This class could just work with a change in the header-file | 12 | * Info: This class could just work with a change in the header-file |
13 | * of the Contact class ! Therefore our libopie only compiles | 13 | * of the Contact class ! Therefore our libopie only compiles |
14 | * with our version of libqpe | 14 | * with our version of libqpe |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * ToDo: XML-Backend: Automatic reload if something was changed... | 16 | * ToDo: XML-Backend: Automatic reload if something was changed... |
17 | * | 17 | * |
18 | * | 18 | * |
19 | * ===================================================================== | 19 | * ===================================================================== |
20 | * Version: $Id$ | 20 | * Version: $Id$ |
21 | * ===================================================================== | 21 | * ===================================================================== |
22 | * History: | 22 | * History: |
23 | * $Log$ | 23 | * $Log$ |
24 | * Revision 1.9 2004/03/02 12:14:22 alwin | ||
25 | * run the optimize_connect script | ||
26 | * the whole cvs is tagged with "before_optimize_connect" if there are problems you | ||
27 | * can check the diff (but it had compiled and run here) | ||
28 | * | ||
24 | * Revision 1.8 2003/05/08 13:55:09 tille | 29 | * Revision 1.8 2003/05/08 13:55:09 tille |
25 | * search stuff | 30 | * search stuff |
26 | * and match, toRichText & toShortText in oevent | 31 | * and match, toRichText & toShortText in oevent |
27 | * | 32 | * |
28 | * Revision 1.7 2002/11/13 14:14:51 eilers | 33 | * Revision 1.7 2002/11/13 14:14:51 eilers |
29 | * Added sorted for Contacts.. | 34 | * Added sorted for Contacts.. |
30 | * | 35 | * |
31 | * Revision 1.6 2002/11/01 15:10:42 eilers | 36 | * Revision 1.6 2002/11/01 15:10:42 eilers |
32 | * Added regExp-search in database for all fields in a contact. | 37 | * Added regExp-search in database for all fields in a contact. |
33 | * | 38 | * |
34 | * Revision 1.5 2002/10/16 10:52:40 eilers | 39 | * Revision 1.5 2002/10/16 10:52:40 eilers |
35 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | 40 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) |
36 | * | 41 | * |
37 | * Revision 1.4 2002/10/14 16:21:54 eilers | 42 | * Revision 1.4 2002/10/14 16:21:54 eilers |
38 | * Some minor interface updates | 43 | * Some minor interface updates |
39 | * | 44 | * |
40 | * Revision 1.3 2002/10/07 17:34:24 eilers | 45 | * Revision 1.3 2002/10/07 17:34:24 eilers |
41 | * added OBackendFactory for advanced backend access | 46 | * added OBackendFactory for advanced backend access |
42 | * | 47 | * |
43 | * Revision 1.2 2002/10/02 16:18:11 eilers | 48 | * Revision 1.2 2002/10/02 16:18:11 eilers |
44 | * debugged and seems to work almost perfectly .. | 49 | * debugged and seems to work almost perfectly .. |
45 | * | 50 | * |
46 | * Revision 1.1 2002/09/27 17:11:44 eilers | 51 | * Revision 1.1 2002/09/27 17:11:44 eilers |
47 | * Added API for accessing the Contact-Database ! It is compiling, but | 52 | * Added API for accessing the Contact-Database ! It is compiling, but |
48 | * please do not expect that anything is working ! | 53 | * please do not expect that anything is working ! |
49 | * I will debug that stuff in the next time .. | 54 | * I will debug that stuff in the next time .. |
50 | * Please read README_COMPILE for compiling ! | 55 | * Please read README_COMPILE for compiling ! |
51 | * | 56 | * |
52 | * | 57 | * |
53 | */ | 58 | */ |
54 | 59 | ||
55 | #include "ocontactaccess.h" | 60 | #include "ocontactaccess.h" |
56 | #include "obackendfactory.h" | 61 | #include "obackendfactory.h" |
57 | 62 | ||
58 | #include <qasciidict.h> | 63 | #include <qasciidict.h> |
59 | #include <qdatetime.h> | 64 | #include <qdatetime.h> |
60 | #include <qfile.h> | 65 | #include <qfile.h> |
61 | #include <qregexp.h> | 66 | #include <qregexp.h> |
62 | #include <qlist.h> | 67 | #include <qlist.h> |
63 | #include <qcopchannel_qws.h> | 68 | #include <qcopchannel_qws.h> |
64 | 69 | ||
65 | //#include <qpe/qcopenvelope_qws.h> | 70 | //#include <qpe/qcopenvelope_qws.h> |
66 | #include <qpe/global.h> | 71 | #include <qpe/global.h> |
67 | 72 | ||
68 | #include <errno.h> | 73 | #include <errno.h> |
69 | #include <fcntl.h> | 74 | #include <fcntl.h> |
70 | #include <unistd.h> | 75 | #include <unistd.h> |
71 | #include <stdlib.h> | 76 | #include <stdlib.h> |
72 | 77 | ||
73 | #include "ocontactaccessbackend_xml.h" | 78 | #include "ocontactaccessbackend_xml.h" |
74 | 79 | ||
75 | 80 | ||
76 | OContactAccess::OContactAccess ( const QString appname, const QString , | 81 | OContactAccess::OContactAccess ( const QString appname, const QString , |
77 | OContactAccessBackend* end, bool autosync ): | 82 | OContactAccessBackend* end, bool autosync ): |
78 | OPimAccessTemplate<OContact>( end ) | 83 | OPimAccessTemplate<OContact>( end ) |
79 | { | 84 | { |
80 | /* take care of the backend. If there is no one defined, we | 85 | /* take care of the backend. If there is no one defined, we |
81 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). | 86 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). |
82 | */ | 87 | */ |
83 | if( end == 0 ) { | 88 | if( end == 0 ) { |
84 | qWarning ("Using BackendFactory !"); | 89 | qWarning ("Using BackendFactory !"); |
85 | end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); | 90 | end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); |
86 | } | 91 | } |
87 | // Set backend locally and in template | 92 | // Set backend locally and in template |
88 | m_backEnd = end; | 93 | m_backEnd = end; |
89 | OPimAccessTemplate<OContact>::setBackEnd (end); | 94 | OPimAccessTemplate<OContact>::setBackEnd (end); |
90 | 95 | ||
91 | 96 | ||
92 | /* Connect signal of external db change to function */ | 97 | /* Connect signal of external db change to function */ |
93 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); | 98 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); |
94 | connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), | 99 | connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
95 | this, SLOT(copMessage( const QCString &, const QByteArray &)) ); | 100 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
96 | if ( autosync ){ | 101 | if ( autosync ){ |
97 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); | 102 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); |
98 | connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)), | 103 | connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
99 | this, SLOT(copMessage( const QCString &, const QByteArray &)) ); | 104 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
100 | } | 105 | } |
101 | 106 | ||
102 | 107 | ||
103 | } | 108 | } |
104 | OContactAccess::~OContactAccess () | 109 | OContactAccess::~OContactAccess () |
105 | { | 110 | { |
106 | /* The user may forget to save the changed database, therefore try to | 111 | /* The user may forget to save the changed database, therefore try to |
107 | * do it for him.. | 112 | * do it for him.. |
108 | */ | 113 | */ |
109 | save(); | 114 | save(); |
110 | // delete m_backEnd; is done by template.. | 115 | // delete m_backEnd; is done by template.. |
111 | } | 116 | } |
112 | 117 | ||
113 | 118 | ||
114 | bool OContactAccess::save () | 119 | bool OContactAccess::save () |
115 | { | 120 | { |
116 | /* If the database was changed externally, we could not save the | 121 | /* If the database was changed externally, we could not save the |
117 | * Data. This will remove added items which is unacceptable ! | 122 | * Data. This will remove added items which is unacceptable ! |
118 | * Therefore: Reload database and merge the data... | 123 | * Therefore: Reload database and merge the data... |
119 | */ | 124 | */ |
120 | if ( OPimAccessTemplate<OContact>::wasChangedExternally() ) | 125 | if ( OPimAccessTemplate<OContact>::wasChangedExternally() ) |
121 | reload(); | 126 | reload(); |
122 | 127 | ||
123 | bool status = OPimAccessTemplate<OContact>::save(); | 128 | bool status = OPimAccessTemplate<OContact>::save(); |
124 | if ( !status ) return false; | 129 | if ( !status ) return false; |
125 | 130 | ||
126 | /* Now tell everyone that new data is available. | 131 | /* Now tell everyone that new data is available. |
127 | */ | 132 | */ |
128 | QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); | 133 | QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); |
129 | 134 | ||
130 | return true; | 135 | return true; |
131 | } | 136 | } |
132 | 137 | ||
133 | const uint OContactAccess::querySettings() | 138 | const uint OContactAccess::querySettings() |
134 | { | 139 | { |
135 | return ( m_backEnd->querySettings() ); | 140 | return ( m_backEnd->querySettings() ); |
136 | } | 141 | } |
137 | 142 | ||
138 | bool OContactAccess::hasQuerySettings ( int querySettings ) const | 143 | bool OContactAccess::hasQuerySettings ( int querySettings ) const |
139 | { | 144 | { |
140 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); | 145 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); |
141 | } | 146 | } |
142 | ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const | 147 | ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const |
143 | { | 148 | { |
144 | QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); | 149 | QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); |
145 | return ( ORecordList<OContact>(matchingContacts, this) ); | 150 | return ( ORecordList<OContact>(matchingContacts, this) ); |
146 | } | 151 | } |
147 | 152 | ||
diff --git a/libopie/pim/opimmainwindow.cpp b/libopie/pim/opimmainwindow.cpp index 2739e26..99a0333 100644 --- a/libopie/pim/opimmainwindow.cpp +++ b/libopie/pim/opimmainwindow.cpp | |||
@@ -1,72 +1,72 @@ | |||
1 | #include <qapplication.h> | 1 | #include <qapplication.h> |
2 | #include <qdatetime.h> | 2 | #include <qdatetime.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | 4 | ||
5 | #include <qpe/sound.h> | 5 | #include <qpe/sound.h> |
6 | #include <qpe/qcopenvelope_qws.h> | 6 | #include <qpe/qcopenvelope_qws.h> |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | #include "opimresolver.h" | 9 | #include "opimresolver.h" |
10 | #include "opimmainwindow.h" | 10 | #include "opimmainwindow.h" |
11 | 11 | ||
12 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, | 12 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, |
13 | const char* name, WFlags flag ) | 13 | const char* name, WFlags flag ) |
14 | : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { | 14 | : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * let's generate our QCopChannel | 17 | * let's generate our QCopChannel |
18 | */ | 18 | */ |
19 | m_str = QString("QPE/"+m_service).local8Bit(); | 19 | m_str = QString("QPE/"+m_service).local8Bit(); |
20 | m_channel= new QCopChannel(m_str, this ); | 20 | m_channel= new QCopChannel(m_str, this ); |
21 | connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), | 21 | connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ), |
22 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 22 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
23 | connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), | 23 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ), |
24 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 24 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
25 | 25 | ||
26 | /* connect flush and reload */ | 26 | /* connect flush and reload */ |
27 | connect(qApp, SIGNAL(flush() ), | 27 | connect(qApp, SIGNAL(flush() ), |
28 | this, SLOT(flush() ) ); | 28 | this, SLOT(flush() ) ); |
29 | connect(qApp, SIGNAL(reload() ), | 29 | connect(qApp, SIGNAL(reload() ), |
30 | this, SLOT(reload() ) ); | 30 | this, SLOT(reload() ) ); |
31 | } | 31 | } |
32 | OPimMainWindow::~OPimMainWindow() { | 32 | OPimMainWindow::~OPimMainWindow() { |
33 | delete m_channel; | 33 | delete m_channel; |
34 | } | 34 | } |
35 | QCopChannel* OPimMainWindow::channel() { | 35 | QCopChannel* OPimMainWindow::channel() { |
36 | return m_channel; | 36 | return m_channel; |
37 | } | 37 | } |
38 | void OPimMainWindow::doSetDocument( const QString& ) { | 38 | void OPimMainWindow::doSetDocument( const QString& ) { |
39 | 39 | ||
40 | } | 40 | } |
41 | void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { | 41 | void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { |
42 | bool needShow = false; | 42 | bool needShow = false; |
43 | /* | 43 | /* |
44 | * create demands to create | 44 | * create demands to create |
45 | * a new record... | 45 | * a new record... |
46 | */ | 46 | */ |
47 | QDataStream stream(array, IO_ReadOnly); | 47 | QDataStream stream(array, IO_ReadOnly); |
48 | if ( cmd == "create()" ) { | 48 | if ( cmd == "create()" ) { |
49 | raise(); | 49 | raise(); |
50 | int uid = create(); | 50 | int uid = create(); |
51 | QCopEnvelope e(m_str, "created(int)" ); | 51 | QCopEnvelope e(m_str, "created(int)" ); |
52 | e << uid; | 52 | e << uid; |
53 | needShow = true; | 53 | needShow = true; |
54 | }else if ( cmd == "remove(int)" ) { | 54 | }else if ( cmd == "remove(int)" ) { |
55 | int uid; | 55 | int uid; |
56 | stream >> uid; | 56 | stream >> uid; |
57 | bool rem = remove( uid ); | 57 | bool rem = remove( uid ); |
58 | QCopEnvelope e(m_str, "removed(bool)" ); | 58 | QCopEnvelope e(m_str, "removed(bool)" ); |
59 | e << rem; | 59 | e << rem; |
60 | needShow = true; | 60 | needShow = true; |
61 | }else if ( cmd == "beam(int)" ) { | 61 | }else if ( cmd == "beam(int)" ) { |
62 | int uid; | 62 | int uid; |
63 | stream >> uid; | 63 | stream >> uid; |
64 | beam( uid); | 64 | beam( uid); |
65 | }else if ( cmd == "show(int)" ) { | 65 | }else if ( cmd == "show(int)" ) { |
66 | raise(); | 66 | raise(); |
67 | int uid; | 67 | int uid; |
68 | stream >> uid; | 68 | stream >> uid; |
69 | show( uid ); | 69 | show( uid ); |
70 | needShow = true; | 70 | needShow = true; |
71 | }else if ( cmd == "edit(int)" ) { | 71 | }else if ( cmd == "edit(int)" ) { |
72 | raise(); | 72 | raise(); |