-rw-r--r-- | libopie/colordialog.cpp | 2 | ||||
-rw-r--r-- | libopie/colordialog.h | 4 | ||||
-rw-r--r-- | libopie/colorpopupmenu.h | 6 | ||||
-rw-r--r-- | libopie/ocheckitem.h | 9 | ||||
-rw-r--r-- | libopie/oclickablelabel.h | 11 | ||||
-rw-r--r-- | libopie/ocolorbutton.h | 6 | ||||
-rw-r--r-- | libopie/odevicebutton.cpp | 14 | ||||
-rw-r--r-- | libopie/ofileselector.h | 17 | ||||
-rw-r--r-- | libopie/ofontselector.h | 3 | ||||
-rw-r--r-- | libopie/oprocess.h | 24 | ||||
-rw-r--r-- | libopie/orecurrancewidget.h | 6 | ||||
-rw-r--r-- | libopie/otabbar.h | 2 | ||||
-rw-r--r-- | libopie/otabinfo.h | 8 | ||||
-rw-r--r-- | libopie/otabwidget.h | 10 | ||||
-rw-r--r-- | libopie/oticker.h | 3 | ||||
-rw-r--r-- | libopie/otimepicker.h | 8 | ||||
-rw-r--r-- | libopie/todayconfigwidget.h | 2 | ||||
-rw-r--r-- | libopie/todayplugininterface.h | 3 |
18 files changed, 93 insertions, 45 deletions
diff --git a/libopie/colordialog.cpp b/libopie/colordialog.cpp index 35f15d6..c7421ec 100644 --- a/libopie/colordialog.cpp +++ b/libopie/colordialog.cpp | |||
@@ -503,356 +503,356 @@ QColorShower::QColorShower( QWidget *parent, const char *name ) | |||
503 | rEd = new QColNumLineEdit( this ); | 503 | rEd = new QColNumLineEdit( this ); |
504 | rEd->setValidator( val256 ); | 504 | rEd->setValidator( val256 ); |
505 | l = new QLabel( rEd, OColorDialog::tr("Red:"), this ); | 505 | l = new QLabel( rEd, OColorDialog::tr("Red:"), this ); |
506 | l->setAlignment( AlignRight|AlignVCenter ); | 506 | l->setAlignment( AlignRight|AlignVCenter ); |
507 | gl->addWidget( l, 0, 3 ); | 507 | gl->addWidget( l, 0, 3 ); |
508 | gl->addWidget( rEd, 0, 4 ); | 508 | gl->addWidget( rEd, 0, 4 ); |
509 | 509 | ||
510 | gEd = new QColNumLineEdit( this ); | 510 | gEd = new QColNumLineEdit( this ); |
511 | gEd->setValidator( val256 ); | 511 | gEd->setValidator( val256 ); |
512 | l = new QLabel( gEd, OColorDialog::tr("Green:"), this ); | 512 | l = new QLabel( gEd, OColorDialog::tr("Green:"), this ); |
513 | l->setAlignment( AlignRight|AlignVCenter ); | 513 | l->setAlignment( AlignRight|AlignVCenter ); |
514 | gl->addWidget( l, 1, 3 ); | 514 | gl->addWidget( l, 1, 3 ); |
515 | gl->addWidget( gEd, 1, 4 ); | 515 | gl->addWidget( gEd, 1, 4 ); |
516 | 516 | ||
517 | bEd = new QColNumLineEdit( this ); | 517 | bEd = new QColNumLineEdit( this ); |
518 | bEd->setValidator( val256 ); | 518 | bEd->setValidator( val256 ); |
519 | l = new QLabel( bEd, OColorDialog::tr("Blue:"), this ); | 519 | l = new QLabel( bEd, OColorDialog::tr("Blue:"), this ); |
520 | l->setAlignment( AlignRight|AlignVCenter ); | 520 | l->setAlignment( AlignRight|AlignVCenter ); |
521 | gl->addWidget( l, 2, 3 ); | 521 | gl->addWidget( l, 2, 3 ); |
522 | gl->addWidget( bEd, 2, 4 ); | 522 | gl->addWidget( bEd, 2, 4 ); |
523 | 523 | ||
524 | alphaEd = new QColNumLineEdit( this ); | 524 | alphaEd = new QColNumLineEdit( this ); |
525 | alphaEd->setValidator( val256 ); | 525 | alphaEd->setValidator( val256 ); |
526 | alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this ); | 526 | alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this ); |
527 | alphaLab->setAlignment( AlignRight|AlignVCenter ); | 527 | alphaLab->setAlignment( AlignRight|AlignVCenter ); |
528 | gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 ); | 528 | gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 ); |
529 | gl->addWidget( alphaEd, 3, 4 ); | 529 | gl->addWidget( alphaEd, 3, 4 ); |
530 | alphaEd->hide(); | 530 | alphaEd->hide(); |
531 | alphaLab->hide(); | 531 | alphaLab->hide(); |
532 | 532 | ||
533 | connect( hEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); | 533 | connect( hEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); |
534 | connect( sEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); | 534 | connect( sEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); |
535 | connect( vEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); | 535 | connect( vEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); |
536 | 536 | ||
537 | connect( rEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); | 537 | connect( rEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); |
538 | connect( gEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); | 538 | connect( gEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); |
539 | connect( bEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); | 539 | connect( bEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); |
540 | } | 540 | } |
541 | 541 | ||
542 | void QColorShower::showCurrentColor() | 542 | void QColorShower::showCurrentColor() |
543 | { | 543 | { |
544 | lab->setColor( currentColor() ); | 544 | lab->setColor( currentColor() ); |
545 | lab->repaint(FALSE); //### | 545 | lab->repaint(FALSE); //### |
546 | } | 546 | } |
547 | 547 | ||
548 | void QColorShower::rgbEd() | 548 | void QColorShower::rgbEd() |
549 | { | 549 | { |
550 | rgbOriginal = TRUE; | 550 | rgbOriginal = TRUE; |
551 | curCol = qRgb( rEd->val(), gEd->val(), bEd->val() ); | 551 | curCol = qRgb( rEd->val(), gEd->val(), bEd->val() ); |
552 | rgb2hsv(currentColor(), hue, sat, val ); | 552 | rgb2hsv(currentColor(), hue, sat, val ); |
553 | 553 | ||
554 | hEd->setNum( hue ); | 554 | hEd->setNum( hue ); |
555 | sEd->setNum( sat ); | 555 | sEd->setNum( sat ); |
556 | vEd->setNum( val ); | 556 | vEd->setNum( val ); |
557 | 557 | ||
558 | showCurrentColor(); | 558 | showCurrentColor(); |
559 | emit newCol( currentColor() ); | 559 | emit newCol( currentColor() ); |
560 | } | 560 | } |
561 | 561 | ||
562 | void QColorShower::hsvEd() | 562 | void QColorShower::hsvEd() |
563 | { | 563 | { |
564 | rgbOriginal = FALSE; | 564 | rgbOriginal = FALSE; |
565 | hue = hEd->val(); | 565 | hue = hEd->val(); |
566 | sat = sEd->val(); | 566 | sat = sEd->val(); |
567 | val = vEd->val(); | 567 | val = vEd->val(); |
568 | 568 | ||
569 | curCol = QColor( hue, sat, val, QColor::Hsv ).rgb(); | 569 | curCol = QColor( hue, sat, val, QColor::Hsv ).rgb(); |
570 | 570 | ||
571 | rEd->setNum( qRed(currentColor()) ); | 571 | rEd->setNum( qRed(currentColor()) ); |
572 | gEd->setNum( qGreen(currentColor()) ); | 572 | gEd->setNum( qGreen(currentColor()) ); |
573 | bEd->setNum( qBlue(currentColor()) ); | 573 | bEd->setNum( qBlue(currentColor()) ); |
574 | 574 | ||
575 | showCurrentColor(); | 575 | showCurrentColor(); |
576 | emit newCol( currentColor() ); | 576 | emit newCol( currentColor() ); |
577 | } | 577 | } |
578 | 578 | ||
579 | void QColorShower::setRgb( QRgb rgb ) | 579 | void QColorShower::setRgb( QRgb rgb ) |
580 | { | 580 | { |
581 | rgbOriginal = TRUE; | 581 | rgbOriginal = TRUE; |
582 | curCol = rgb; | 582 | curCol = rgb; |
583 | 583 | ||
584 | rgb2hsv( currentColor(), hue, sat, val ); | 584 | rgb2hsv( currentColor(), hue, sat, val ); |
585 | 585 | ||
586 | hEd->setNum( hue ); | 586 | hEd->setNum( hue ); |
587 | sEd->setNum( sat ); | 587 | sEd->setNum( sat ); |
588 | vEd->setNum( val ); | 588 | vEd->setNum( val ); |
589 | 589 | ||
590 | rEd->setNum( qRed(currentColor()) ); | 590 | rEd->setNum( qRed(currentColor()) ); |
591 | gEd->setNum( qGreen(currentColor()) ); | 591 | gEd->setNum( qGreen(currentColor()) ); |
592 | bEd->setNum( qBlue(currentColor()) ); | 592 | bEd->setNum( qBlue(currentColor()) ); |
593 | 593 | ||
594 | showCurrentColor(); | 594 | showCurrentColor(); |
595 | } | 595 | } |
596 | 596 | ||
597 | void QColorShower::setHsv( int h, int s, int v ) | 597 | void QColorShower::setHsv( int h, int s, int v ) |
598 | { | 598 | { |
599 | rgbOriginal = FALSE; | 599 | rgbOriginal = FALSE; |
600 | hue = h; val = v; sat = s; //Range check### | 600 | hue = h; val = v; sat = s; //Range check### |
601 | curCol = QColor( hue, sat, val, QColor::Hsv ).rgb(); | 601 | curCol = QColor( hue, sat, val, QColor::Hsv ).rgb(); |
602 | 602 | ||
603 | hEd->setNum( hue ); | 603 | hEd->setNum( hue ); |
604 | sEd->setNum( sat ); | 604 | sEd->setNum( sat ); |
605 | vEd->setNum( val ); | 605 | vEd->setNum( val ); |
606 | 606 | ||
607 | rEd->setNum( qRed(currentColor()) ); | 607 | rEd->setNum( qRed(currentColor()) ); |
608 | gEd->setNum( qGreen(currentColor()) ); | 608 | gEd->setNum( qGreen(currentColor()) ); |
609 | bEd->setNum( qBlue(currentColor()) ); | 609 | bEd->setNum( qBlue(currentColor()) ); |
610 | 610 | ||
611 | 611 | ||
612 | showCurrentColor(); | 612 | showCurrentColor(); |
613 | } | 613 | } |
614 | 614 | ||
615 | } | 615 | } |
616 | 616 | ||
617 | class OColorDialogPrivate : public QObject | 617 | class OColorDialogPrivate : public QObject |
618 | { | 618 | { |
619 | Q_OBJECT | 619 | Q_OBJECT |
620 | public: | 620 | public: |
621 | OColorDialogPrivate( OColorDialog *p ); | 621 | OColorDialogPrivate( OColorDialog *p ); |
622 | QRgb currentColor() const { return cs->currentColor(); } | 622 | QRgb currentColor() const { return cs->currentColor(); } |
623 | void setCurrentColor( const QRgb& rgb ); | 623 | void setCurrentColor( const QRgb& rgb ); |
624 | 624 | ||
625 | int currentAlpha() const { return cs->currentAlpha(); } | 625 | int currentAlpha() const { return cs->currentAlpha(); } |
626 | void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); } | 626 | void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); } |
627 | void showAlpha( bool b ) { cs->showAlpha( b ); } | 627 | void showAlpha( bool b ) { cs->showAlpha( b ); } |
628 | 628 | ||
629 | private slots: | 629 | private slots: |
630 | void newHsv( int h, int s, int v ); | 630 | void newHsv( int h, int s, int v ); |
631 | void newColorTypedIn( QRgb rgb ); | 631 | void newColorTypedIn( QRgb rgb ); |
632 | private: | 632 | private: |
633 | QColorPicker *cp; | 633 | QColorPicker *cp; |
634 | QColorLuminancePicker *lp; | 634 | QColorLuminancePicker *lp; |
635 | QColorShower *cs; | 635 | QColorShower *cs; |
636 | }; | 636 | }; |
637 | 637 | ||
638 | //sets all widgets to display h,s,v | 638 | //sets all widgets to display h,s,v |
639 | void OColorDialogPrivate::newHsv( int h, int s, int v ) | 639 | void OColorDialogPrivate::newHsv( int h, int s, int v ) |
640 | { | 640 | { |
641 | cs->setHsv( h, s, v ); | 641 | cs->setHsv( h, s, v ); |
642 | cp->setCol( h, s ); | 642 | cp->setCol( h, s ); |
643 | lp->setCol( h, s, v ); | 643 | lp->setCol( h, s, v ); |
644 | } | 644 | } |
645 | 645 | ||
646 | //sets all widgets to display rgb | 646 | //sets all widgets to display rgb |
647 | void OColorDialogPrivate::setCurrentColor( const QRgb& rgb ) | 647 | void OColorDialogPrivate::setCurrentColor( const QRgb& rgb ) |
648 | { | 648 | { |
649 | cs->setRgb( rgb ); | 649 | cs->setRgb( rgb ); |
650 | newColorTypedIn( rgb ); | 650 | newColorTypedIn( rgb ); |
651 | } | 651 | } |
652 | 652 | ||
653 | //sets all widgets exept cs to display rgb | 653 | //sets all widgets exept cs to display rgb |
654 | void OColorDialogPrivate::newColorTypedIn( QRgb rgb ) | 654 | void OColorDialogPrivate::newColorTypedIn( QRgb rgb ) |
655 | { | 655 | { |
656 | int h, s, v; | 656 | int h, s, v; |
657 | rgb2hsv(rgb, h, s, v ); | 657 | rgb2hsv(rgb, h, s, v ); |
658 | cp->setCol( h, s ); | 658 | cp->setCol( h, s ); |
659 | lp->setCol( h, s, v); | 659 | lp->setCol( h, s, v); |
660 | } | 660 | } |
661 | 661 | ||
662 | OColorDialogPrivate::OColorDialogPrivate( OColorDialog *dialog ) : | 662 | OColorDialogPrivate::OColorDialogPrivate( OColorDialog *dialog ) : |
663 | QObject(dialog) | 663 | QObject(dialog) |
664 | { | 664 | { |
665 | int border = 2; | 665 | int border = 2; |
666 | QVBoxLayout *topLay = new QVBoxLayout( dialog, border, 2 ); | 666 | QVBoxLayout *topLay = new QVBoxLayout( dialog, border, 2 ); |
667 | 667 | ||
668 | QHBoxLayout *pickLay = new QHBoxLayout( topLay ); | 668 | QHBoxLayout *pickLay = new QHBoxLayout( topLay ); |
669 | 669 | ||
670 | 670 | ||
671 | cp = new QColorPicker( dialog ); | 671 | cp = new QColorPicker( dialog ); |
672 | cp->setFrameStyle( QFrame::Panel + QFrame::Sunken ); | 672 | cp->setFrameStyle( QFrame::Panel + QFrame::Sunken ); |
673 | pickLay->addWidget( cp ); | 673 | pickLay->addWidget( cp ); |
674 | 674 | ||
675 | pickLay->addStretch(); | 675 | pickLay->addStretch(); |
676 | 676 | ||
677 | lp = new QColorLuminancePicker( dialog ); | 677 | lp = new QColorLuminancePicker( dialog ); |
678 | lp->setFixedWidth( 20 ); //### | 678 | lp->setFixedWidth( 20 ); //### |
679 | pickLay->addWidget( lp ); | 679 | pickLay->addWidget( lp ); |
680 | 680 | ||
681 | connect( cp, SIGNAL(newCol(int,int)), lp, SLOT(setCol(int,int)) ); | 681 | connect( cp, SIGNAL(newCol(int,int)), lp, SLOT(setCol(int,int)) ); |
682 | connect( lp, SIGNAL(newHsv(int,int,int)), this, SLOT(newHsv(int,int,int)) ); | 682 | connect( lp, SIGNAL(newHsv(int,int,int)), this, SLOT(newHsv(int,int,int)) ); |
683 | 683 | ||
684 | topLay->addStretch(); | 684 | topLay->addStretch(); |
685 | 685 | ||
686 | cs = new QColorShower( dialog ); | 686 | cs = new QColorShower( dialog ); |
687 | connect( cs, SIGNAL(newCol(QRgb)), this, SLOT(newColorTypedIn(QRgb))); | 687 | connect( cs, SIGNAL(newCol(QRgb)), this, SLOT(newColorTypedIn(QRgb))); |
688 | topLay->addWidget( cs ); | 688 | topLay->addWidget( cs ); |
689 | 689 | ||
690 | } | 690 | } |
691 | 691 | ||
692 | 692 | ||
693 | // BEING REVISED: jo | 693 | // BEING REVISED: jo |
694 | /*! | 694 | /*! |
695 | \class OColorDialog OColorDialog.h | 695 | \class ColorDialog ColorDialog.h |
696 | \brief The OColorDialog class provides a dialog widget for specifying colors. | 696 | \brief The OColorDialog class provides a dialog widget for specifying colors. |
697 | \ingroup dialogs | 697 | \ingroup dialogs |
698 | 698 | ||
699 | The color dialog's function is to allow users to choose colors - | 699 | The color dialog's function is to allow users to choose colors - |
700 | for instance, you might use this in a drawing program to allow the | 700 | for instance, you might use this in a drawing program to allow the |
701 | user to set the brush color. | 701 | user to set the brush color. |
702 | 702 | ||
703 | This version of Qt only provides modal color dialogs. The static | 703 | This version of Qt only provides modal color dialogs. The static |
704 | getColor() function shows the dialog and allows the user to specify a color, | 704 | getColor() function shows the dialog and allows the user to specify a color, |
705 | while getRgba() does the same but allows the user to specify a color with an | 705 | while getRgba() does the same but allows the user to specify a color with an |
706 | alpha channel (transparency) value. | 706 | alpha channel (transparency) value. |
707 | 707 | ||
708 | The user can store customCount() different custom colors. The custom | 708 | The user can store customCount() different custom colors. The custom |
709 | colors are shared by all color dialogs, and remembered during the | 709 | colors are shared by all color dialogs, and remembered during the |
710 | execution of the program. Use setCustomColor() to set the | 710 | execution of the program. Use setCustomColor() to set the |
711 | custom colors, and customColor() to get them. | 711 | custom colors, and customColor() to get them. |
712 | 712 | ||
713 | <img src=qcolordlg-m.png> <img src=qcolordlg-w.png> | 713 | <img src=qcolordlg-m.png> <img src=qcolordlg-w.png> |
714 | */ | 714 | */ |
715 | 715 | ||
716 | /*! | 716 | /*! |
717 | Constructs a default color dialog. Use setColor() for setting an initial value. | 717 | Constructs a default color dialog. Use setColor() for setting an initial value. |
718 | 718 | ||
719 | \sa getColor() | 719 | \sa getColor() |
720 | */ | 720 | */ |
721 | 721 | ||
722 | OColorDialog::OColorDialog(QWidget* parent, const char* name, bool modal) : | 722 | OColorDialog::OColorDialog(QWidget* parent, const char* name, bool modal) : |
723 | QDialog(parent, name, modal ) | 723 | QDialog(parent, name, modal ) |
724 | { | 724 | { |
725 | d = new OColorDialogPrivate( this ); | 725 | d = new OColorDialogPrivate( this ); |
726 | } | 726 | } |
727 | 727 | ||
728 | 728 | ||
729 | /*! | 729 | /*! |
730 | Pops up a modal color dialog letting the user choose a color and returns | 730 | Pops up a modal color dialog letting the user choose a color and returns |
731 | that color. The color is initially set to \a initial. Returns an \link QColor::isValid() invalid\endlink color if the user cancels | 731 | that color. The color is initially set to \a initial. Returns an \link QColor::isValid() invalid\endlink color if the user cancels |
732 | the dialog. All colors allocated by the dialog will be deallocated | 732 | the dialog. All colors allocated by the dialog will be deallocated |
733 | before this function returns. | 733 | before this function returns. |
734 | */ | 734 | */ |
735 | 735 | ||
736 | QColor OColorDialog::getColor( const QColor& initial, QWidget *parent, | 736 | QColor OColorDialog::getColor( const QColor& initial, QWidget *parent, |
737 | const char *name ) | 737 | const char *name ) |
738 | { | 738 | { |
739 | int allocContext = QColor::enterAllocContext(); | 739 | int allocContext = QColor::enterAllocContext(); |
740 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal | 740 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal |
741 | if ( parent && parent->icon() && !parent->icon()->isNull() ) | 741 | if ( parent && parent->icon() && !parent->icon()->isNull() ) |
742 | dlg->setIcon( *parent->icon() ); | 742 | dlg->setIcon( *parent->icon() ); |
743 | else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) | 743 | else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) |
744 | dlg->setIcon( *qApp->mainWidget()->icon() ); | 744 | dlg->setIcon( *qApp->mainWidget()->icon() ); |
745 | 745 | ||
746 | dlg->setCaption( OColorDialog::tr( "Select color" ) ); | 746 | dlg->setCaption( OColorDialog::tr( "Select color" ) ); |
747 | dlg->setColor( initial ); | 747 | dlg->setColor( initial ); |
748 | dlg->showMaximized(); | 748 | dlg->showMaximized(); |
749 | int resultCode = dlg->exec(); | 749 | int resultCode = dlg->exec(); |
750 | QColor::leaveAllocContext(); | 750 | QColor::leaveAllocContext(); |
751 | QColor result; | 751 | QColor result; |
752 | if ( resultCode == QDialog::Accepted ) { | 752 | if ( resultCode == QDialog::Accepted ) { |
753 | result = dlg->color(); | 753 | result = dlg->color(); |
754 | } else { | 754 | } else { |
755 | result = initial; | 755 | result = initial; |
756 | } | 756 | } |
757 | QColor::destroyAllocContext(allocContext); | 757 | QColor::destroyAllocContext(allocContext); |
758 | delete dlg; | 758 | delete dlg; |
759 | return result; | 759 | return result; |
760 | } | 760 | } |
761 | 761 | ||
762 | 762 | ||
763 | /*! | 763 | /*! |
764 | Pops up a modal color dialog, letting the user choose a color and an | 764 | Pops up a modal color dialog, letting the user choose a color and an |
765 | alpha channel value. The color+alpha is initially set to \a initial. | 765 | alpha channel value. The color+alpha is initially set to \a initial. |
766 | 766 | ||
767 | If \a ok is non-null, \c *ok is set to TRUE if the user clicked OK, | 767 | If \a ok is non-null, \c *ok is set to TRUE if the user clicked OK, |
768 | and FALSE if the user clicked Cancel. | 768 | and FALSE if the user clicked Cancel. |
769 | 769 | ||
770 | If the user clicks Cancel the \a initial value is returned. | 770 | If the user clicks Cancel the \a initial value is returned. |
771 | */ | 771 | */ |
772 | 772 | ||
773 | QRgb OColorDialog::getRgba( const QRgb& initial, bool *ok, | 773 | QRgb OColorDialog::getRgba( const QRgb& initial, bool *ok, |
774 | QWidget *parent, const char* name ) | 774 | QWidget *parent, const char* name ) |
775 | { | 775 | { |
776 | int allocContext = QColor::enterAllocContext(); | 776 | int allocContext = QColor::enterAllocContext(); |
777 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal | 777 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal |
778 | dlg->setColor( initial ); | 778 | dlg->setColor( initial ); |
779 | dlg->setSelectedAlpha( qAlpha(initial) ); | 779 | dlg->setSelectedAlpha( qAlpha(initial) ); |
780 | dlg->showMaximized(); | 780 | dlg->showMaximized(); |
781 | int resultCode = dlg->exec(); | 781 | int resultCode = dlg->exec(); |
782 | QColor::leaveAllocContext(); | 782 | QColor::leaveAllocContext(); |
783 | QRgb result = initial; | 783 | QRgb result = initial; |
784 | if ( resultCode == QDialog::Accepted ) { | 784 | if ( resultCode == QDialog::Accepted ) { |
785 | QRgb c = dlg->color().rgb(); | 785 | QRgb c = dlg->color().rgb(); |
786 | int alpha = dlg->selectedAlpha(); | 786 | int alpha = dlg->selectedAlpha(); |
787 | result = qRgba( qRed(c), qGreen(c), qBlue(c), alpha ); | 787 | result = qRgba( qRed(c), qGreen(c), qBlue(c), alpha ); |
788 | } | 788 | } |
789 | if ( ok ) | 789 | if ( ok ) |
790 | *ok = resultCode == QDialog::Accepted; | 790 | *ok = resultCode == QDialog::Accepted; |
791 | 791 | ||
792 | QColor::destroyAllocContext(allocContext); | 792 | QColor::destroyAllocContext(allocContext); |
793 | delete dlg; | 793 | delete dlg; |
794 | return result; | 794 | return result; |
795 | } | 795 | } |
796 | 796 | ||
797 | 797 | ||
798 | 798 | ||
799 | 799 | ||
800 | 800 | ||
801 | /*! | 801 | /*! |
802 | Returns the color currently selected in the dialog. | 802 | Returns the color currently selected in the dialog. |
803 | 803 | ||
804 | \sa setColor() | 804 | \sa setColor() |
805 | */ | 805 | */ |
806 | 806 | ||
807 | QColor OColorDialog::color() const | 807 | QColor OColorDialog::color() const |
808 | { | 808 | { |
809 | return QColor(d->currentColor()); | 809 | return QColor(d->currentColor()); |
810 | } | 810 | } |
811 | 811 | ||
812 | 812 | ||
813 | /*! Destructs the dialog and frees any memory it allocated. | 813 | /*! Destructs the dialog and frees any memory it allocated. |
814 | 814 | ||
815 | */ | 815 | */ |
816 | 816 | ||
817 | OColorDialog::~OColorDialog() | 817 | OColorDialog::~OColorDialog() |
818 | { | 818 | { |
819 | //d inherits QObject, so it is deleted by Qt. | 819 | //d inherits QObject, so it is deleted by Qt. |
820 | } | 820 | } |
821 | 821 | ||
822 | 822 | ||
823 | /*! | 823 | /*! |
824 | Sets the color shown in the dialog to \a c. | 824 | Sets the color shown in the dialog to \a c. |
825 | 825 | ||
826 | \sa color() | 826 | \sa color() |
827 | */ | 827 | */ |
828 | 828 | ||
829 | void OColorDialog::setColor( const QColor& c ) | 829 | void OColorDialog::setColor( const QColor& c ) |
830 | { | 830 | { |
831 | d->setCurrentColor( c.rgb() ); | 831 | d->setCurrentColor( c.rgb() ); |
832 | } | 832 | } |
833 | 833 | ||
834 | 834 | ||
835 | 835 | ||
836 | 836 | ||
837 | /*! | 837 | /*! |
838 | Sets the initial alpha channel value to \a a, and show the alpha channel | 838 | Sets the initial alpha channel value to \a a, and show the alpha channel |
839 | entry box. | 839 | entry box. |
840 | */ | 840 | */ |
841 | 841 | ||
842 | void OColorDialog::setSelectedAlpha( int a ) | 842 | void OColorDialog::setSelectedAlpha( int a ) |
843 | { | 843 | { |
844 | d->showAlpha( TRUE ); | 844 | d->showAlpha( TRUE ); |
845 | d->setCurrentAlpha( a ); | 845 | d->setCurrentAlpha( a ); |
846 | } | 846 | } |
847 | 847 | ||
848 | 848 | ||
849 | /*! | 849 | /*! |
850 | Returns the value selected for the alpha channel. | 850 | Returns the value selected for the alpha channel. |
851 | */ | 851 | */ |
852 | 852 | ||
853 | int OColorDialog::selectedAlpha() const | 853 | int OColorDialog::selectedAlpha() const |
854 | { | 854 | { |
855 | return d->currentAlpha(); | 855 | return d->currentAlpha(); |
856 | } | 856 | } |
857 | 857 | ||
858 | #include "colordialog.moc" | 858 | #include "colordialog.moc" |
diff --git a/libopie/colordialog.h b/libopie/colordialog.h index e9bb7ed..1a6a3fd 100644 --- a/libopie/colordialog.h +++ b/libopie/colordialog.h | |||
@@ -1,89 +1,89 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of OColorDialog class | 4 | ** Definition of OColorDialog class |
5 | ** | 5 | ** |
6 | ** Created : 990222 | 6 | ** Created : 990222 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. | 10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef OColorDialog_H | 38 | #ifndef OColorDialog_H |
39 | #define OColorDialog_H | 39 | #define OColorDialog_H |
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include <qdialog.h> | 42 | #include <qdialog.h> |
43 | #endif // QT_H | 43 | #endif // QT_H |
44 | 44 | ||
45 | class OColorDialogPrivate; | 45 | class OColorDialogPrivate; |
46 | 46 | ||
47 | /** | 47 | /* |
48 | * @class OColorDialog | 48 | * @class OColorDialog |
49 | * @brief The OColorDialog class is a copy of QColorDialog for use in Opie. | 49 | * @brief The OColorDialog class is a copy of QColorDialog for use in Opie. |
50 | * | 50 | * |
51 | * OColorDialog is a copy of TrollTech's QColorDialog for use in Opie. The default | 51 | * OColorDialog is a copy of TrollTech's QColorDialog for use in Opie. The default |
52 | * build of QT/Embedded used by Opie does not include QColorDialog, so it is provided | 52 | * build of QT/Embedded used by Opie does not include QColorDialog, so it is provided |
53 | * here. It is renamed to prevent conflicts in the event the QColorDialog is included | 53 | * here. It is renamed to prevent conflicts in the event the QColorDialog is included |
54 | * at a later date in QP/E. | 54 | * at a later date in QP/E. |
55 | * | 55 | * |
56 | * See http://doc.trolltech.com/2.3/qcolordialog.html for complete documentation of | 56 | * See http://doc.trolltech.com/2.3/qcolordialog.html for complete documentation of |
57 | * QColorDialog. | 57 | * QColorDialog. |
58 | */ | 58 | */ |
59 | class Q_EXPORT OColorDialog : public QDialog | 59 | class Q_EXPORT OColorDialog : public QDialog |
60 | { | 60 | { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | 62 | ||
63 | public: | 63 | public: |
64 | static QColor getColor( const QColor&, QWidget *parent=0, const char* name=0 ); | 64 | static QColor getColor( const QColor&, QWidget *parent=0, const char* name=0 ); |
65 | static QRgb getRgba( const QRgb&, bool* ok = 0, | 65 | static QRgb getRgba( const QRgb&, bool* ok = 0, |
66 | QWidget *parent=0, const char* name=0 ); | 66 | QWidget *parent=0, const char* name=0 ); |
67 | 67 | ||
68 | private: | 68 | private: |
69 | ~OColorDialog(); | 69 | ~OColorDialog(); |
70 | 70 | ||
71 | OColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE ); | 71 | OColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE ); |
72 | void setColor( const QColor& ); | 72 | void setColor( const QColor& ); |
73 | QColor color() const; | 73 | QColor color() const; |
74 | 74 | ||
75 | private: | 75 | private: |
76 | void setSelectedAlpha( int ); | 76 | void setSelectedAlpha( int ); |
77 | int selectedAlpha() const; | 77 | int selectedAlpha() const; |
78 | private: | 78 | private: |
79 | OColorDialogPrivate *d; | 79 | OColorDialogPrivate *d; |
80 | friend class OColorDialogPrivate; | 80 | friend class OColorDialogPrivate; |
81 | 81 | ||
82 | private:// Disabled copy constructor and operator= | 82 | private:// Disabled copy constructor and operator= |
83 | #if defined(Q_DISABLE_COPY) | 83 | #if defined(Q_DISABLE_COPY) |
84 | OColorDialog( const OColorDialog & ); | 84 | OColorDialog( const OColorDialog & ); |
85 | OColorDialog& operator=( const OColorDialog & ); | 85 | OColorDialog& operator=( const OColorDialog & ); |
86 | #endif | 86 | #endif |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #endif | 89 | #endif |
diff --git a/libopie/colorpopupmenu.h b/libopie/colorpopupmenu.h index 184b132..3e90c5e 100644 --- a/libopie/colorpopupmenu.h +++ b/libopie/colorpopupmenu.h | |||
@@ -1,254 +1,254 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net> | 4 | Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net> |
5 | Dan Williams <williamsdr@acm.org> | 5 | Dan Williams <williamsdr@acm.org> |
6 | =. | 6 | =. |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef COLORPOPUPMENU_H | 33 | #ifndef COLORPOPUPMENU_H |
34 | #define COLORPOPUPMENU_H | 34 | #define COLORPOPUPMENU_H |
35 | 35 | ||
36 | #include <qframe.h> | 36 | #include <qframe.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | 38 | ||
39 | class QWidget; | 39 | class QWidget; |
40 | class QGridLayout; | 40 | class QGridLayout; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @class OColorPanelButton | 43 | * @class OColorPanelButton |
44 | * @brief The OColorPanelButton class provides a button for color selection. | 44 | * @brief The OColorPanelButton class provides a button for color selection. |
45 | * | 45 | * |
46 | * @see OColorPopupMenu | 46 | * @see OColorPopupMenu |
47 | * | 47 | * |
48 | * The OColorPanelButton class provides a button for color selection. The button | 48 | * The OColorPanelButton class provides a button for color selection. The button |
49 | * is drawn with the desired color and no border. This class is used internally | 49 | * is drawn with the desired color and no border. This class is used internally |
50 | * by the OColorPopupMenu class to displaying colors in its menu. | 50 | * by the OColorPopupMenu class to displaying colors in its menu. |
51 | */ | 51 | */ |
52 | class OColorPanelButton : public QFrame | 52 | class OColorPanelButton : public QFrame |
53 | { | 53 | { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * @fn OColorPanelButton( const QColor& color, QWidget* parent = 0, const char* name = 0 ) | 59 | * @fn OColorPanelButton( const QColor& color, QWidget* parent = 0, const char* name = 0 ) |
60 | * @brief Object constructor. | 60 | * @brief Object constructor. |
61 | * | 61 | * |
62 | * @param color Desired color. | 62 | * @param color Desired color. |
63 | * @param parent Pointer to parent of this control. | 63 | * @param parent Pointer to parent of this control. |
64 | * @param name Name of control. | 64 | * @param name Name of control. |
65 | * | 65 | * |
66 | * Constructs a new ColorPanelButton control with parent, name and desired color. | 66 | * Constructs a new ColorPanelButton control with parent, name and desired color. |
67 | */ | 67 | */ |
68 | OColorPanelButton(const QColor& color, QWidget* parent = 0, const char* name = 0); | 68 | OColorPanelButton(const QColor& color, QWidget* parent = 0, const char* name = 0); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * @fn ~ColorPanelButton() | 71 | * @fn ~OColorPanelButton() |
72 | * @brief Object destructor. | 72 | * @brief Object destructor. |
73 | */ | 73 | */ |
74 | ~OColorPanelButton(); | 74 | ~OColorPanelButton(); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * @fn setActive( bool active ) | 77 | * @fn setActive( bool active ) |
78 | * @brief Sets button selection state. | 78 | * @brief Sets button selection state. |
79 | * | 79 | * |
80 | * @param active Boolean indicator of new button state. | 80 | * @param active Boolean indicator of new button state. |
81 | * | 81 | * |
82 | * Changes button selection state. If button is selected, a highlighted border | 82 | * Changes button selection state. If button is selected, a highlighted border |
83 | * is drawn. | 83 | * is drawn. |
84 | */ | 84 | */ |
85 | void setActive(bool active); | 85 | void setActive(bool active); |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * @fn enterEvent( QEvent* e ) | 88 | * @fn enterEvent( QEvent* e ) |
89 | * @brief Reimplemented for internal reasons. | 89 | * @brief Reimplemented for internal reasons. |
90 | * | 90 | * |
91 | * @param e Event currently being processed. | 91 | * @param e Event currently being processed. |
92 | * | 92 | * |
93 | * Reimplemented to ensure correct display of button based on whether it is | 93 | * Reimplemented to ensure correct display of button based on whether it is |
94 | * active or not. | 94 | * active or not. |
95 | */ | 95 | */ |
96 | void enterEvent(QEvent* e); | 96 | void enterEvent(QEvent* e); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * @fn leaveEvent( QEvent* e ) | 99 | * @fn leaveEvent( QEvent* e ) |
100 | * @brief Reimplemented for internal reasons. | 100 | * @brief Reimplemented for internal reasons. |
101 | * | 101 | * |
102 | * @param e Event currently being processed. | 102 | * @param e Event currently being processed. |
103 | * | 103 | * |
104 | * Reimplemented to ensure correct display of button based on whether it is | 104 | * Reimplemented to ensure correct display of button based on whether it is |
105 | * active or not. | 105 | * active or not. |
106 | */ | 106 | */ |
107 | void leaveEvent(QEvent* e); | 107 | void leaveEvent(QEvent* e); |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * @fn paintEvent( QEvent* e ) | 110 | * @fn paintEvent( QPaintEvent* e ) |
111 | * @brief Reimplemented for internal reasons. | 111 | * @brief Reimplemented for internal reasons. |
112 | * | 112 | * |
113 | * @param e Event currently being processed. | 113 | * @param e Event currently being processed. |
114 | * | 114 | * @reimp |
115 | * Reimplemented to ensure correct display of button. | 115 | * Reimplemented to ensure correct display of button. |
116 | */ | 116 | */ |
117 | void paintEvent(QPaintEvent* e); | 117 | void paintEvent(QPaintEvent* e); |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * @fn mouseReleaseEvent( QMouseEvent* e ) | 120 | * @fn mouseReleaseEvent( QMouseEvent* e ) |
121 | * @brief Slot executed when button is pressed. | 121 | * @brief Slot executed when button is pressed. |
122 | * | 122 | * |
123 | * @param e Mouse event currently being processed. | 123 | * @param e Mouse event currently being processed. |
124 | * | 124 | * |
125 | * @see selected() | 125 | * @see selected() |
126 | * | 126 | * |
127 | * This slot executes when the button has been pressed. It emits the selected | 127 | * This slot executes when the button has been pressed. It emits the selected |
128 | * signal as notification that it has been pressed. | 128 | * signal as notification that it has been pressed. |
129 | */ | 129 | */ |
130 | void mouseReleaseEvent(QMouseEvent* e); | 130 | void mouseReleaseEvent(QMouseEvent* e); |
131 | 131 | ||
132 | signals: | 132 | signals: |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * @fn selected( const QColor& color ) | 135 | * @fn selected( const QColor& color ) |
136 | * @brief Signal to indicate button has been pressed. | 136 | * @brief Signal to indicate button has been pressed. |
137 | * | 137 | * |
138 | * @param color Button color. | 138 | * @param color Button color. |
139 | * | 139 | * |
140 | * This signal is emitted when the button is pressed. It provides the color | 140 | * This signal is emitted when the button is pressed. It provides the color |
141 | * associated to this button. | 141 | * associated to this button. |
142 | */ | 142 | */ |
143 | void selected(const QColor&); | 143 | void selected(const QColor&); |
144 | 144 | ||
145 | private: | 145 | private: |
146 | QColor m_color; | 146 | QColor m_color; |
147 | bool m_active : 1; | 147 | bool m_active : 1; |
148 | class ColorPanelButtonPrivate; | 148 | class ColorPanelButtonPrivate; |
149 | ColorPanelButtonPrivate *d; | 149 | ColorPanelButtonPrivate *d; |
150 | }; | 150 | }; |
151 | 151 | ||
152 | /** | 152 | /** |
153 | * @class OColorPopupMenu | 153 | * @class OColorPopupMenu |
154 | * @brief The OColorPopupMenu class provides a small color selection | 154 | * @brief The OColorPopupMenu class provides a small color selection |
155 | * popup menu. | 155 | * popup menu. |
156 | * | 156 | * |
157 | * OColorPopupMenu is a derivation of TrollTech's QPopupMenu and provides | 157 | * OColorPopupMenu is a derivation of TrollTech's QPopupMenu and provides |
158 | * a small color selection popup menu which can be attached to another control | 158 | * a small color selection popup menu which can be attached to another control |
159 | * such as a toolbar button of menu item. | 159 | * such as a toolbar button of menu item. |
160 | * | 160 | * |
161 | * The popup menu displays 30 default colors available in a grid, and also | 161 | * The popup menu displays 30 default colors available in a grid, and also |
162 | * includes an option at the bottom to display a color selection dialog box for | 162 | * includes an option at the bottom to display a color selection dialog box for |
163 | * finer color control. | 163 | * finer color control. |
164 | */ | 164 | */ |
165 | class OColorPopupMenu : public QPopupMenu | 165 | class OColorPopupMenu : public QPopupMenu |
166 | { | 166 | { |
167 | Q_OBJECT | 167 | Q_OBJECT |
168 | 168 | ||
169 | public: | 169 | public: |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * @fn OColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ) | 172 | * @fn OColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ) |
173 | * @brief Object constructor. | 173 | * @brief Object constructor. |
174 | * | 174 | * |
175 | * @param color Initial color selected in menu. | 175 | * @param color Initial color selected in menu. |
176 | * @param parent Pointer to parent of this control. | 176 | * @param parent Pointer to parent of this control. |
177 | * @param name Name of control. | 177 | * @param name Name of control. |
178 | * | 178 | * |
179 | * Constructs a new OColorPopupMenu control with parent, name and initial color selected. | 179 | * Constructs a new OColorPopupMenu control with parent, name and initial color selected. |
180 | */ | 180 | */ |
181 | OColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ); | 181 | OColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * @fn ~OColorPopupMenu() | 184 | * @fn ~OColorPopupMenu() |
185 | * @brief Object destructor. | 185 | * @brief Object destructor. |
186 | */ | 186 | */ |
187 | ~OColorPopupMenu(); | 187 | ~OColorPopupMenu(); |
188 | 188 | ||
189 | private: | 189 | private: |
190 | class ColorPopupMenuPrivate; | 190 | class ColorPopupMenuPrivate; |
191 | ColorPopupMenuPrivate *d; | 191 | ColorPopupMenuPrivate *d; |
192 | QColor m_color; | 192 | QColor m_color; |
193 | QWidget* colorPanel; | 193 | QWidget* colorPanel; |
194 | QGridLayout* colorLayout; | 194 | QGridLayout* colorLayout; |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * @fn addColor( const QColor& color, int row, int col ) | 197 | * @fn addColor( const QColor& color, int row, int col ) |
198 | * @brief Adds color selection option to popup menu. | 198 | * @brief Adds color selection option to popup menu. |
199 | * | 199 | * |
200 | * @param color Color to be displayed in menu. | 200 | * @param color Color to be displayed in menu. |
201 | * @param row Row where color is to appear in menu. | 201 | * @param row Row where color is to appear in menu. |
202 | * @param col Column where color is to appear in menu. | 202 | * @param col Column where color is to appear in menu. |
203 | * | 203 | * |
204 | * Adds a color selection option to popup menu. Used internally when | 204 | * Adds a color selection option to popup menu. Used internally when |
205 | * initially constructing the menu control. | 205 | * initially constructing the menu control. |
206 | */ | 206 | */ |
207 | void addColor( const QColor& color, int row, int col ); | 207 | void addColor( const QColor& color, int row, int col ); |
208 | 208 | ||
209 | signals: | 209 | signals: |
210 | 210 | ||
211 | /** | 211 | /** |
212 | * @fn colorSelected( const QColor& color ) | 212 | * @fn colorSelected( const QColor& color ) |
213 | * @brief Signal to indicate color chosen from the menu. | 213 | * @brief Signal to indicate color chosen from the menu. |
214 | * | 214 | * |
215 | * @param color Color selected from the menu. | 215 | * @param color Color selected from the menu. |
216 | * | 216 | * |
217 | * This signal is emitted when a color has been selected either directly from | 217 | * This signal is emitted when a color has been selected either directly from |
218 | * the menu, or chosen from the color selection dialog. | 218 | * the menu, or chosen from the color selection dialog. |
219 | */ | 219 | */ |
220 | void colorSelected( const QColor& color ); | 220 | void colorSelected( const QColor& color ); |
221 | 221 | ||
222 | protected slots: | 222 | protected slots: |
223 | 223 | ||
224 | /** | 224 | /** |
225 | * @fn buttonSelected( const QColor& color ) | 225 | * @fn buttonSelected( const QColor& color ) |
226 | * @brief Slot to process selected color. | 226 | * @brief Slot to process selected color. |
227 | * | 227 | * |
228 | * @param color Color selected from the menu. | 228 | * @param color Color selected from the menu. |
229 | * | 229 | * |
230 | * @see colorSelected() | 230 | * @see colorSelected() |
231 | * | 231 | * |
232 | * This slot executes when a color has been selected from the menu. It performs | 232 | * This slot executes when a color has been selected from the menu. It performs |
233 | * two functions: | 233 | * two functions: |
234 | * - Emit the colorSelected signal with the color selected. | 234 | * - Emit the colorSelected signal with the color selected. |
235 | * - Hide the menu. | 235 | * - Hide the menu. |
236 | */ | 236 | */ |
237 | void buttonSelected( const QColor& color ); | 237 | void buttonSelected( const QColor& color ); |
238 | 238 | ||
239 | /** | 239 | /** |
240 | * @fn moreColorClicked() | 240 | * @fn moreColorClicked() |
241 | * @brief Slot to process display color selection dialog. | 241 | * @brief Slot to process display color selection dialog. |
242 | * | 242 | * |
243 | * @see colorSelected() | 243 | * @see colorSelected() |
244 | * | 244 | * |
245 | * This slot executes when the 'More...' option is selected at the bottom of the menu. | 245 | * This slot executes when the 'More...' option is selected at the bottom of the menu. |
246 | * It performs the following functions: | 246 | * It performs the following functions: |
247 | * - Constructs and executes a OColorDialog to allow finer color selection. | 247 | * - Constructs and executes a OColorDialog to allow finer color selection. |
248 | * - Emit the colorSelected signal with the color selected. | 248 | * - Emit the colorSelected signal with the color selected. |
249 | * - Hide the menu. | 249 | * - Hide the menu. |
250 | */ | 250 | */ |
251 | void moreColorClicked(); | 251 | void moreColorClicked(); |
252 | }; | 252 | }; |
253 | 253 | ||
254 | #endif // COLORPOPUPMENUANEL_H | 254 | #endif // COLORPOPUPMENUANEL_H |
diff --git a/libopie/ocheckitem.h b/libopie/ocheckitem.h index 2387134..82ee3d0 100644 --- a/libopie/ocheckitem.h +++ b/libopie/ocheckitem.h | |||
@@ -1,53 +1,62 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de) | 2 | ** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de) |
3 | ** | 3 | ** |
4 | ** This file may be distributed and/or modified under the terms of the | 4 | ** This file may be distributed and/or modified under the terms of the |
5 | ** GNU Library General Public License version 2 as published by the | 5 | ** GNU Library General Public License version 2 as published by the |
6 | ** Free Software Foundation and appearing in the file LICENSE.GPL | 6 | ** Free Software Foundation and appearing in the file LICENSE.GPL |
7 | ** included in the packaging of this file. | 7 | ** included in the packaging of this file. |
8 | ** | 8 | ** |
9 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 9 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
11 | **********************************************************************/ | 11 | **********************************************************************/ |
12 | #include <qtable.h> | 12 | #include <qtable.h> |
13 | 13 | ||
14 | #ifndef CHECKITEM_H__ | 14 | #ifndef CHECKITEM_H__ |
15 | #define CHECKITEM_H__ | 15 | #define CHECKITEM_H__ |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * This class represents a checkable QTableItem. This can | 18 | * This class represents a checkable QTableItem. This can |
19 | * be added to any QTable. | 19 | * be added to any QTable. |
20 | * | 20 | * |
21 | * | 21 | * |
22 | * @see QTable | 22 | * @see QTable |
23 | * @see QTableItem | 23 | * @see QTableItem |
24 | * @short An checkable QTableItem | 24 | * @short An checkable QTableItem |
25 | * @version 1.0 | 25 | * @version 1.0 |
26 | * @author Stefan Eilers ( eilers@handhelds.org ) | 26 | * @author Stefan Eilers ( eilers@handhelds.org ) |
27 | */ | 27 | */ |
28 | 28 | ||
29 | class OCheckItem : public QTableItem | 29 | class OCheckItem : public QTableItem |
30 | { | 30 | { |
31 | public: | 31 | public: |
32 | /** The size of a box currently unused */ | ||
32 | enum Size { BoxSize = 10 }; | 33 | enum Size { BoxSize = 10 }; |
33 | OCheckItem( QTable *t, const QString &sortkey ); | 34 | OCheckItem( QTable *t, const QString &sortkey ); |
34 | 35 | ||
35 | virtual void setChecked( bool b ); | 36 | virtual void setChecked( bool b ); |
36 | virtual void toggle(); | 37 | virtual void toggle(); |
37 | bool isChecked() const; | 38 | bool isChecked() const; |
39 | /** | ||
40 | * @short Set the sort key | ||
41 | * @reimp | ||
42 | */ | ||
38 | void setKey( const QString &key ) { m_sortKey = key; } | 43 | void setKey( const QString &key ) { m_sortKey = key; } |
39 | virtual QString key() const; | 44 | virtual QString key() const; |
40 | 45 | ||
46 | /** | ||
47 | * foo | ||
48 | * @internal | ||
49 | */ | ||
41 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); | 50 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); |
42 | 51 | ||
43 | //static const int BoxSize = 10; | 52 | //static const int BoxSize = 10; |
44 | 53 | ||
45 | private: | 54 | private: |
46 | class OCheckItemPrivate; | 55 | class OCheckItemPrivate; |
47 | OCheckItemPrivate *d; | 56 | OCheckItemPrivate *d; |
48 | bool m_checked: 1; | 57 | bool m_checked: 1; |
49 | QString m_sortKey; | 58 | QString m_sortKey; |
50 | 59 | ||
51 | }; | 60 | }; |
52 | 61 | ||
53 | #endif | 62 | #endif |
diff --git a/libopie/oclickablelabel.h b/libopie/oclickablelabel.h index 4b6dcbc..6e7a123 100644 --- a/libopie/oclickablelabel.h +++ b/libopie/oclickablelabel.h | |||
@@ -1,53 +1,64 @@ | |||
1 | #ifndef CLICKABLELABEL | 1 | #ifndef CLICKABLELABEL |
2 | #define CLICKABLELABEL | 2 | #define CLICKABLELABEL |
3 | 3 | ||
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | 5 | ||
6 | /** | 6 | /** |
7 | * This class is a special QLabel which can behave | 7 | * This class is a special QLabel which can behave |
8 | * as a QPushButton or QToggleButton. | 8 | * as a QPushButton or QToggleButton. |
9 | * The reason to use a clickable is if you want to save space | 9 | * The reason to use a clickable is if you want to save space |
10 | * or you want to skip the border of a normal button | 10 | * or you want to skip the border of a normal button |
11 | * | 11 | * |
12 | * <pre> | 12 | * <pre> |
13 | * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); | 13 | * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); |
14 | * lbl->setPixmap( "config" ); | 14 | * lbl->setPixmap( "config" ); |
15 | * QWhatsThis::add( lbl, tr("Click here to do something") ); | 15 | * QWhatsThis::add( lbl, tr("Click here to do something") ); |
16 | * </pre> | 16 | * </pre> |
17 | * | 17 | * |
18 | * @short A Label behaving as button | 18 | * @short A Label behaving as button |
19 | * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) | 19 | * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) |
20 | * @see QLabel | 20 | * @see QLabel |
21 | * @see QPushButton | 21 | * @see QPushButton |
22 | * @see QToggleButton | 22 | * @see QToggleButton |
23 | * @version 1.0 | 23 | * @version 1.0 |
24 | */ | 24 | */ |
25 | 25 | ||
26 | class OClickableLabel: public QLabel | 26 | class OClickableLabel: public QLabel |
27 | { | 27 | { |
28 | Q_OBJECT | 28 | Q_OBJECT |
29 | public: | 29 | public: |
30 | OClickableLabel(QWidget* parent = 0, const char* name = 0, | 30 | OClickableLabel(QWidget* parent = 0, const char* name = 0, |
31 | WFlags fl = 0); | 31 | WFlags fl = 0); |
32 | void setToggleButton(bool t); | 32 | void setToggleButton(bool t); |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | /** @internal */ | ||
35 | void mousePressEvent( QMouseEvent *e ); | 36 | void mousePressEvent( QMouseEvent *e ); |
37 | /** @internal */ | ||
36 | void mouseReleaseEvent( QMouseEvent *e ); | 38 | void mouseReleaseEvent( QMouseEvent *e ); |
39 | /** @internal */ | ||
37 | void mouseMoveEvent( QMouseEvent *e ); | 40 | void mouseMoveEvent( QMouseEvent *e ); |
38 | 41 | ||
39 | public slots: | 42 | public slots: |
40 | void setOn(bool on); | 43 | void setOn(bool on); |
41 | signals: | 44 | signals: |
45 | /** | ||
46 | * emitted when the labels gets clicked | ||
47 | */ | ||
42 | void clicked(); | 48 | void clicked(); |
49 | |||
50 | /** | ||
51 | * emitted when the labels gets toggled | ||
52 | * @param the new new state of the label | ||
53 | */ | ||
43 | void toggled(bool on); | 54 | void toggled(bool on); |
44 | private: | 55 | private: |
45 | bool isToggle : 1; | 56 | bool isToggle : 1; |
46 | bool isDown : 1; | 57 | bool isDown : 1; |
47 | bool textInverted : 1; | 58 | bool textInverted : 1; |
48 | 59 | ||
49 | void showState(bool on); | 60 | void showState(bool on); |
50 | void setInverted(bool on); | 61 | void setInverted(bool on); |
51 | }; | 62 | }; |
52 | 63 | ||
53 | #endif | 64 | #endif |
diff --git a/libopie/ocolorbutton.h b/libopie/ocolorbutton.h index 338e654..7ff9cd2 100644 --- a/libopie/ocolorbutton.h +++ b/libopie/ocolorbutton.h | |||
@@ -1,66 +1,72 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
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 | #ifndef __OPIE_OCOLORBUTTON_H__ | 29 | #ifndef __OPIE_OCOLORBUTTON_H__ |
30 | #define __OPIE_OCOLORBUTTON_H__ | 30 | #define __OPIE_OCOLORBUTTON_H__ |
31 | 31 | ||
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | 33 | ||
34 | class OColorButtonPrivate; | 34 | class OColorButtonPrivate; |
35 | class QColor; | 35 | class QColor; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * | 38 | * |
39 | * @short A Button which will show a OColorPopupMenu | 39 | * @short A Button which will show a OColorPopupMenu |
40 | * @author Robert Griebl ( sandman@handhelds.org ) | 40 | * @author Robert Griebl ( sandman@handhelds.org ) |
41 | * @version 1.0 | 41 | * @version 1.0 |
42 | * @see QPushButton | 42 | * @see QPushButton |
43 | */ | 43 | */ |
44 | class OColorButton : public QPushButton { | 44 | class OColorButton : public QPushButton { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | OColorButton ( QWidget *parent = 0, const QColor & = black, const char *name = 0 ); | 47 | OColorButton ( QWidget *parent = 0, const QColor & = black, const char *name = 0 ); |
48 | virtual ~OColorButton ( ); | 48 | virtual ~OColorButton ( ); |
49 | 49 | ||
50 | QColor color ( ) const; | 50 | QColor color ( ) const; |
51 | 51 | ||
52 | signals: | 52 | signals: |
53 | /** | ||
54 | * emitted when a color gets selected | ||
55 | */ | ||
53 | void colorSelected ( const QColor & ); | 56 | void colorSelected ( const QColor & ); |
54 | 57 | ||
55 | public slots: | 58 | public slots: |
56 | virtual void setColor ( const QColor & ); | 59 | virtual void setColor ( const QColor & ); |
57 | 60 | ||
58 | protected slots: | 61 | protected slots: |
62 | /** | ||
63 | * @internal | ||
64 | */ | ||
59 | virtual void updateColor ( const QColor & ); | 65 | virtual void updateColor ( const QColor & ); |
60 | 66 | ||
61 | private: | 67 | private: |
62 | OColorButtonPrivate *d; | 68 | OColorButtonPrivate *d; |
63 | }; | 69 | }; |
64 | 70 | ||
65 | #endif | 71 | #endif |
66 | 72 | ||
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp index 4b22358..eccb57c 100644 --- a/libopie/odevicebutton.cpp +++ b/libopie/odevicebutton.cpp | |||
@@ -1,235 +1,235 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | 23 | ||
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <opie/odevicebutton.h> | 25 | #include <opie/odevicebutton.h> |
26 | 26 | ||
27 | using namespace Opie; | 27 | using namespace Opie; |
28 | 28 | ||
29 | 29 | ||
30 | class OQCopMessageData { | 30 | class OQCopMessageData { |
31 | public: | 31 | public: |
32 | QCString m_channel; | 32 | QCString m_channel; |
33 | QCString m_message; | 33 | QCString m_message; |
34 | QByteArray m_data; | 34 | QByteArray m_data; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | 37 | ||
38 | OQCopMessage::OQCopMessage ( ) | 38 | OQCopMessage::OQCopMessage ( ) |
39 | : d ( 0 ) | 39 | : d ( 0 ) |
40 | { | 40 | { |
41 | init ( QCString ( ), QCString ( ), QByteArray ( )); | 41 | init ( QCString ( ), QCString ( ), QByteArray ( )); |
42 | } | 42 | } |
43 | 43 | ||
44 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) | 44 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) |
45 | : d ( 0 ) | 45 | : d ( 0 ) |
46 | { | 46 | { |
47 | init ( copy. channel ( ), copy. message ( ), copy. data ( )); | 47 | init ( copy. channel ( ), copy. message ( ), copy. data ( )); |
48 | } | 48 | } |
49 | 49 | ||
50 | OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) | 50 | OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) |
51 | { | 51 | { |
52 | init ( assign. channel ( ), assign. message ( ), assign. data ( )); | 52 | init ( assign. channel ( ), assign. message ( ), assign. data ( )); |
53 | return *this; | 53 | return *this; |
54 | } | 54 | } |
55 | 55 | ||
56 | OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg ) | 56 | OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg ) |
57 | : d ( 0 ) | 57 | : d ( 0 ) |
58 | { | 58 | { |
59 | init ( ch, m, arg ); | 59 | init ( ch, m, arg ); |
60 | } | 60 | } |
61 | 61 | ||
62 | void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg ) | 62 | void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg ) |
63 | { | 63 | { |
64 | if ( !d ) | 64 | if ( !d ) |
65 | d = new OQCopMessageData ( ); | 65 | d = new OQCopMessageData ( ); |
66 | d-> m_channel = ch; | 66 | d-> m_channel = ch; |
67 | d-> m_message = m; | 67 | d-> m_message = m; |
68 | d-> m_data = arg; | 68 | d-> m_data = arg; |
69 | } | 69 | } |
70 | 70 | ||
71 | bool OQCopMessage::send ( ) | 71 | bool OQCopMessage::send ( ) |
72 | { | 72 | { |
73 | if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) ) | 73 | if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) ) |
74 | return false; | 74 | return false; |
75 | 75 | ||
76 | QCopEnvelope e ( d-> m_channel, d-> m_message ); | 76 | QCopEnvelope e ( d-> m_channel, d-> m_message ); |
77 | 77 | ||
78 | if ( d-> m_data. size ( )) | 78 | if ( d-> m_data. size ( )) |
79 | e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( )); | 79 | e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( )); |
80 | 80 | ||
81 | return true; | 81 | return true; |
82 | } | 82 | } |
83 | 83 | ||
84 | QCString OQCopMessage::channel ( ) const | 84 | QCString OQCopMessage::channel ( ) const |
85 | { | 85 | { |
86 | return d-> m_channel; | 86 | return d-> m_channel; |
87 | } | 87 | } |
88 | 88 | ||
89 | QCString OQCopMessage::message ( ) const | 89 | QCString OQCopMessage::message ( ) const |
90 | { | 90 | { |
91 | return d-> m_message; | 91 | return d-> m_message; |
92 | } | 92 | } |
93 | 93 | ||
94 | QByteArray OQCopMessage::data ( ) const | 94 | QByteArray OQCopMessage::data ( ) const |
95 | { | 95 | { |
96 | return d-> m_data; | 96 | return d-> m_data; |
97 | } | 97 | } |
98 | 98 | ||
99 | void OQCopMessage::setChannel ( const QCString &ch ) | 99 | void OQCopMessage::setChannel ( const QCString &ch ) |
100 | { | 100 | { |
101 | d-> m_channel = ch; | 101 | d-> m_channel = ch; |
102 | } | 102 | } |
103 | 103 | ||
104 | void OQCopMessage::setMessage ( const QCString &m ) | 104 | void OQCopMessage::setMessage ( const QCString &m ) |
105 | { | 105 | { |
106 | d-> m_message = m; | 106 | d-> m_message = m; |
107 | } | 107 | } |
108 | 108 | ||
109 | void OQCopMessage::setData ( const QByteArray &data ) | 109 | void OQCopMessage::setData ( const QByteArray &data ) |
110 | { | 110 | { |
111 | d-> m_data = data; | 111 | d-> m_data = data; |
112 | } | 112 | } |
113 | 113 | ||
114 | /*! \class ODeviceButton | 114 | /*! \class Opie::ODeviceButton |
115 | \brief The ODeviceButton class represents a physical user mappable button on a Qtopia device. | 115 | \brief The Opie::ODeviceButton class represents a physical user mappable button on a Qtopia device. |
116 | 116 | ||
117 | This class represents a physical button on a Qtopia device. A | 117 | This class represents a physical button on a Qtopia device. A |
118 | device may have "user programmable" buttons. | 118 | device may have "user programmable" buttons. |
119 | The location and number of buttons will vary from device to | 119 | The location and number of buttons will vary from device to |
120 | device. userText() and pixmap() may be used to describe this button | 120 | device. userText() and pixmap() may be used to describe this button |
121 | to the user in help documentation. | 121 | to the user in help documentation. |
122 | 122 | ||
123 | \ingroup qtopiaemb | 123 | \ingroup qtopiaemb |
124 | \internal | 124 | \internal |
125 | */ | 125 | */ |
126 | 126 | ||
127 | ODeviceButton::ODeviceButton() | 127 | ODeviceButton::ODeviceButton() |
128 | { | 128 | { |
129 | } | 129 | } |
130 | 130 | ||
131 | ODeviceButton::~ODeviceButton() | 131 | ODeviceButton::~ODeviceButton() |
132 | { | 132 | { |
133 | } | 133 | } |
134 | 134 | ||
135 | /*! | 135 | /*! |
136 | Returns the button's keycode. | 136 | Returns the button's keycode. |
137 | */ | 137 | */ |
138 | ushort ODeviceButton::keycode() const | 138 | ushort ODeviceButton::keycode() const |
139 | { | 139 | { |
140 | return m_Keycode; | 140 | return m_Keycode; |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | /*! | 144 | /*! |
145 | This function returns a human readable, translated description of the button. | 145 | This function returns a human readable, translated description of the button. |
146 | */ | 146 | */ |
147 | QString ODeviceButton::userText() const | 147 | QString ODeviceButton::userText() const |
148 | { | 148 | { |
149 | return m_UserText; | 149 | return m_UserText; |
150 | } | 150 | } |
151 | 151 | ||
152 | /*! | 152 | /*! |
153 | This function returns the pixmap for this button. If there isn't one | 153 | This function returns the pixmap for this button. If there isn't one |
154 | it will return an empty (null) pixmap. | 154 | it will return an empty (null) pixmap. |
155 | */ | 155 | */ |
156 | QPixmap ODeviceButton::pixmap() const | 156 | QPixmap ODeviceButton::pixmap() const |
157 | { | 157 | { |
158 | return m_Pixmap; | 158 | return m_Pixmap; |
159 | } | 159 | } |
160 | 160 | ||
161 | /*! | 161 | /*! |
162 | This function returns the factory preset (default) action for when this button | 162 | This function returns the factory preset (default) action for when this button |
163 | is pressed. The return value is a legal QCop message. | 163 | is pressed. The return value is a legal QCop message. |
164 | */ | 164 | */ |
165 | OQCopMessage ODeviceButton::factoryPresetPressedAction() const | 165 | OQCopMessage ODeviceButton::factoryPresetPressedAction() const |
166 | { | 166 | { |
167 | return m_FactoryPresetPressedAction; | 167 | return m_FactoryPresetPressedAction; |
168 | } | 168 | } |
169 | 169 | ||
170 | /*! | 170 | /*! |
171 | This function returns the user assigned action for when this button is pressed. | 171 | This function returns the user assigned action for when this button is pressed. |
172 | If no action is assigned, factoryPresetAction() is returned. | 172 | If no action is assigned, factoryPresetAction() is returned. |
173 | */ | 173 | */ |
174 | OQCopMessage ODeviceButton::pressedAction() const | 174 | OQCopMessage ODeviceButton::pressedAction() const |
175 | { | 175 | { |
176 | if (m_PressedAction.channel().isEmpty()) | 176 | if (m_PressedAction.channel().isEmpty()) |
177 | return factoryPresetPressedAction(); | 177 | return factoryPresetPressedAction(); |
178 | return m_PressedAction; | 178 | return m_PressedAction; |
179 | } | 179 | } |
180 | 180 | ||
181 | /*! | 181 | /*! |
182 | This function returns the factory preset (default) action for when this button | 182 | This function returns the factory preset (default) action for when this button |
183 | is pressed and held. The return value is a legal QCop message. | 183 | is pressed and held. The return value is a legal QCop message. |
184 | */ | 184 | */ |
185 | OQCopMessage ODeviceButton::factoryPresetHeldAction() const | 185 | OQCopMessage ODeviceButton::factoryPresetHeldAction() const |
186 | { | 186 | { |
187 | return m_FactoryPresetHeldAction; | 187 | return m_FactoryPresetHeldAction; |
188 | } | 188 | } |
189 | 189 | ||
190 | /*! | 190 | /*! |
191 | This function returns the user assigned action for when this button is pressed | 191 | This function returns the user assigned action for when this button is pressed |
192 | and held. If no action is assigned, factoryPresetAction() is returned. | 192 | and held. If no action is assigned, factoryPresetAction() is returned. |
193 | */ | 193 | */ |
194 | OQCopMessage ODeviceButton::heldAction() const | 194 | OQCopMessage ODeviceButton::heldAction() const |
195 | { | 195 | { |
196 | if (m_HeldAction.channel().isEmpty()) | 196 | if (m_HeldAction.channel().isEmpty()) |
197 | return factoryPresetHeldAction(); | 197 | return factoryPresetHeldAction(); |
198 | return m_HeldAction; | 198 | return m_HeldAction; |
199 | } | 199 | } |
200 | 200 | ||
201 | void ODeviceButton::setKeycode(ushort keycode) | 201 | void ODeviceButton::setKeycode(ushort keycode) |
202 | { | 202 | { |
203 | m_Keycode = keycode; | 203 | m_Keycode = keycode; |
204 | } | 204 | } |
205 | 205 | ||
206 | void ODeviceButton::setUserText(const QString& text) | 206 | void ODeviceButton::setUserText(const QString& text) |
207 | { | 207 | { |
208 | m_UserText = text; | 208 | m_UserText = text; |
209 | } | 209 | } |
210 | 210 | ||
211 | void ODeviceButton::setPixmap(const QPixmap& picture) | 211 | void ODeviceButton::setPixmap(const QPixmap& picture) |
212 | { | 212 | { |
213 | m_Pixmap = picture; | 213 | m_Pixmap = picture; |
214 | } | 214 | } |
215 | 215 | ||
216 | void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) | 216 | void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) |
217 | { | 217 | { |
218 | m_FactoryPresetPressedAction = action; | 218 | m_FactoryPresetPressedAction = action; |
219 | } | 219 | } |
220 | 220 | ||
221 | 221 | ||
222 | void ODeviceButton::setPressedAction(const OQCopMessage& action) | 222 | void ODeviceButton::setPressedAction(const OQCopMessage& action) |
223 | { | 223 | { |
224 | m_PressedAction = action; | 224 | m_PressedAction = action; |
225 | } | 225 | } |
226 | 226 | ||
227 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) | 227 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) |
228 | { | 228 | { |
229 | m_FactoryPresetHeldAction = action; | 229 | m_FactoryPresetHeldAction = action; |
230 | } | 230 | } |
231 | 231 | ||
232 | void ODeviceButton::setHeldAction(const OQCopMessage& action) | 232 | void ODeviceButton::setHeldAction(const OQCopMessage& action) |
233 | { | 233 | { |
234 | m_HeldAction = action; | 234 | m_HeldAction = action; |
235 | } | 235 | } |
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 06ac806..d06aa0a 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h | |||
@@ -1,263 +1,266 @@ | |||
1 | /* | 1 | /* |
2 | This is based on code and ideas of | 2 | This is based on code and ideas of |
3 | L. J. Potter ljp@llornkcor.com | 3 | L. J. Potter ljp@llornkcor.com |
4 | Thanks a lot | 4 | Thanks a lot |
5 | 5 | ||
6 | 6 | ||
7 | =. This file is part of the OPIE Project | 7 | =. This file is part of the OPIE Project |
8 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 8 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This library is free software; you can | 10 | _;:, .> :=|. This library is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This library is distributed in the hope that | 17 | .i_,=:_. -<s. This library is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef opiefileselector_h | 34 | #ifndef opiefileselector_h |
35 | #define opiefileselector_h | 35 | #define opiefileselector_h |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
41 | #include <qmap.h> | 41 | #include <qmap.h> |
42 | #include <qvaluelist.h> | 42 | #include <qvaluelist.h> |
43 | 43 | ||
44 | #include <qpe/applnk.h> | 44 | #include <qpe/applnk.h> |
45 | #include <qlistview.h> | 45 | #include <qlistview.h> |
46 | 46 | ||
47 | /** This is OPIEs FileDialog Widget. You can use it | 47 | |
48 | * as a dropin replacement of the fileselector and | ||
49 | * or use any of the new features. | ||
50 | * This is also a complete FileSave and FileLoad widget | ||
51 | * If you look for a Dialog check OFileDialog | ||
52 | * | ||
53 | */ | ||
54 | class DocLnk; | 48 | class DocLnk; |
55 | class QCheckBox; | 49 | class QCheckBox; |
56 | class QComboBox; | 50 | class QComboBox; |
57 | class QPushButton; | 51 | class QPushButton; |
58 | class FileSelector; | 52 | class FileSelector; |
59 | class QGridLayout; | 53 | class QGridLayout; |
60 | class QLineEdit; | 54 | class QLineEdit; |
61 | class QLabel; | 55 | class QLabel; |
62 | class QWidgetStack; | 56 | class QWidgetStack; |
63 | class QHBoxLayout; | 57 | class QHBoxLayout; |
64 | class QVBoxLayout; | 58 | class QVBoxLayout; |
65 | class QPopupMenu; | 59 | class QPopupMenu; |
66 | class QFileInfo; | 60 | class QFileInfo; |
67 | class QHBox; | 61 | class QHBox; |
68 | // | 62 | // |
69 | 63 | ||
70 | typedef QMap< QString, QStringList> MimeTypes; | 64 | typedef QMap< QString, QStringList> MimeTypes; |
71 | 65 | ||
66 | /** | ||
67 | * This is OPIEs FileDialog Widget. You can use it | ||
68 | * as a dropin replacement of the fileselector and | ||
69 | * or use any of the new features. | ||
70 | * This is also a complete FileSave and FileLoad widget | ||
71 | * If you look for a Dialog check OFileDialog | ||
72 | * | ||
73 | * NOTE THAT the API will change to be more extendable! | ||
74 | */ | ||
72 | class OFileSelector : public QWidget { | 75 | class OFileSelector : public QWidget { |
73 | Q_OBJECT | 76 | Q_OBJECT |
74 | public: | 77 | public: |
75 | /** | 78 | /** |
76 | * The mode of the file selector | 79 | * The mode of the file selector |
77 | * Either open, save, fileselector or dir browsing mode | 80 | * Either open, save, fileselector or dir browsing mode |
78 | * | 81 | * |
79 | */ | 82 | */ |
80 | enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; | 83 | enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; |
81 | 84 | ||
82 | /** | 85 | /** |
83 | * Selector. Either NORMAL for the one shipped with | 86 | * Selector. Either NORMAL for the one shipped with |
84 | * libqpe or EXTENDED. for the EXTENDED | 87 | * libqpe or EXTENDED. for the EXTENDED |
85 | * EXTENDED_ALL also shows 'hidden' files | 88 | * EXTENDED_ALL also shows 'hidden' files |
86 | */ | 89 | */ |
87 | enum Selector{NORMAL=0, EXTENDED = 1, EXTENDED_ALL =2 }; | 90 | enum Selector{NORMAL=0, EXTENDED = 1, EXTENDED_ALL =2 }; |
88 | 91 | ||
89 | /** | 92 | /** |
90 | * This is reserved for futrue views | 93 | * This is reserved for futrue views |
91 | */ | 94 | */ |
92 | enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; | 95 | enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; |
93 | 96 | ||
94 | /** | 97 | /** |
95 | * A c'tor which should be used for advanced mode | 98 | * A c'tor which should be used for advanced mode |
96 | * @param wid the parent | 99 | * @param wid the parent |
97 | * @param mode the Mode of the Selector | 100 | * @param mode the Mode of the Selector |
98 | * @param selector the current View of the Selector | 101 | * @param selector the current View of the Selector |
99 | * @param dirName in which dir to start | 102 | * @param dirName in which dir to start |
100 | * @param fileName a proposed filename | 103 | * @param fileName a proposed filename |
101 | * @param mimetypes A list of mimetypes \ | 104 | * @param mimetypes A list of mimetypes \ |
102 | * QString is for a identifier name like "Text files" | 105 | * QString is for a identifier name like "Text files" |
103 | * the coresponding QStringList is used for the mimetypes | 106 | * the coresponding QStringList is used for the mimetypes |
104 | * if empty it'll fill the list of mimetypes depending | 107 | * if empty it'll fill the list of mimetypes depending |
105 | * on the content of the current directory | 108 | * on the content of the current directory |
106 | */ | 109 | */ |
107 | 110 | ||
108 | OFileSelector(QWidget *wid, int mode, int selector, | 111 | OFileSelector(QWidget *wid, int mode, int selector, |
109 | const QString &dirName, | 112 | const QString &dirName, |
110 | const QString &fileName = QString::null, | 113 | const QString &fileName = QString::null, |
111 | const MimeTypes &mimetypes = MimeTypes() ); | 114 | const MimeTypes &mimetypes = MimeTypes() ); |
112 | 115 | ||
113 | 116 | ||
114 | /** | 117 | /** |
115 | * This is a QPE compatible c'tor | 118 | * This is a QPE compatible c'tor |
116 | */ | 119 | */ |
117 | OFileSelector(const QString &mimeFilter, QWidget *parent, | 120 | OFileSelector(const QString &mimeFilter, QWidget *parent, |
118 | const char *name, bool newVisible = TRUE, | 121 | const char *name, bool newVisible = TRUE, |
119 | bool closeVisible = FALSE ); | 122 | bool closeVisible = FALSE ); |
120 | 123 | ||
121 | ~OFileSelector(); | 124 | ~OFileSelector(); |
122 | 125 | ||
123 | // currently only for the FILESELECTOR Mode | 126 | // currently only for the FILESELECTOR Mode |
124 | /** | 127 | /** |
125 | */ | 128 | */ |
126 | void setNewVisible( bool /*b*/ ); | 129 | void setNewVisible( bool /*b*/ ); |
127 | void setCloseVisible(bool /*b*/ ); | 130 | void setCloseVisible(bool /*b*/ ); |
128 | 131 | ||
129 | // end file selector mode | 132 | // end file selector mode |
130 | // deprecated | 133 | // deprecated |
131 | void reread(); | 134 | void reread(); |
132 | // make sure not to leak please | 135 | // make sure not to leak please |
133 | const DocLnk *selected(); | 136 | const DocLnk *selected(); |
134 | // end deprecated | 137 | // end deprecated |
135 | 138 | ||
136 | bool isToolbarVisible() const { return m_shTool; }; | 139 | bool isToolbarVisible() const { return m_shTool; }; |
137 | bool isPermissionBarVisible() const { return m_shPerm; }; | 140 | bool isPermissionBarVisible() const { return m_shPerm; }; |
138 | bool isLineEditVisible()const { return m_shLne; }; | 141 | bool isLineEditVisible()const { return m_shLne; }; |
139 | bool isChooserVisible( )const { return m_shChooser; }; | 142 | bool isChooserVisible( )const { return m_shChooser; }; |
140 | bool isYesCancelVisible()const { return m_shYesNo; }; | 143 | bool isYesCancelVisible()const { return m_shYesNo; }; |
141 | void setYesCancelVisible( bool show ); | 144 | void setYesCancelVisible( bool show ); |
142 | void setToolbarVisible( bool show ); | 145 | void setToolbarVisible( bool show ); |
143 | void setPermissionBarVisible( bool show ); | 146 | void setPermissionBarVisible( bool show ); |
144 | void setLineEditVisible(bool show) ; | 147 | void setLineEditVisible(bool show) ; |
145 | void setChooserVisible( bool chooser ); | 148 | void setChooserVisible( bool chooser ); |
146 | 149 | ||
147 | QCheckBox* permissionCheckbox(); | 150 | QCheckBox* permissionCheckbox(); |
148 | bool setPermission() const; | 151 | bool setPermission() const; |
149 | void setPermissionChecked( bool check ); | 152 | void setPermissionChecked( bool check ); |
150 | 153 | ||
151 | void setMode( int ); | 154 | void setMode( int ); |
152 | 155 | ||
153 | bool showDirs()const { return m_dir; } | 156 | bool showDirs()const { return m_dir; } |
154 | void setShowDirs(bool ); | 157 | void setShowDirs(bool ); |
155 | 158 | ||
156 | const QListView* listView() { return m_View; }; | 159 | const QListView* listView() { return m_View; }; |
157 | 160 | ||
158 | bool isCaseSensetive()const { return m_case; } | 161 | bool isCaseSensetive()const { return m_case; } |
159 | void setCaseSensetive(bool caSe ); | 162 | void setCaseSensetive(bool caSe ); |
160 | 163 | ||
161 | bool showFiles()const { return m_files; }; | 164 | bool showFiles()const { return m_files; }; |
162 | void setShowFiles(bool ); | 165 | void setShowFiles(bool ); |
163 | bool cd(const QString &path ); | 166 | bool cd(const QString &path ); |
164 | 167 | ||
165 | 168 | ||
166 | int mode()const { return m_mode; }; | 169 | int mode()const { return m_mode; }; |
167 | int selector()const { return m_selector; }; | 170 | int selector()const { return m_selector; }; |
168 | void setSelector( int ); | 171 | void setSelector( int ); |
169 | 172 | ||
170 | bool showPopup()const { return m_showPopup; }; | 173 | bool showPopup()const { return m_showPopup; }; |
171 | void setShowPopup( bool pop ) { m_showPopup = pop; }; | 174 | void setShowPopup( bool pop ) { m_showPopup = pop; }; |
172 | void setPopupMenu( QPopupMenu * ); | 175 | void setPopupMenu( QPopupMenu * ); |
173 | 176 | ||
174 | // void updateLay(); | 177 | // void updateLay(); |
175 | 178 | ||
176 | void reparse(); // re reads the dir | 179 | void reparse(); // re reads the dir |
177 | 180 | ||
178 | QString selectedName( )const; | 181 | QString selectedName( )const; |
179 | QStringList selectedNames()const; | 182 | QStringList selectedNames()const; |
180 | 183 | ||
181 | QString selectedPath() const; | 184 | QString selectedPath() const; |
182 | QStringList selectedPaths() const; | 185 | QStringList selectedPaths() const; |
183 | 186 | ||
184 | QString directory()const; | 187 | QString directory()const; |
185 | int fileCount() const; | 188 | int fileCount() const; |
186 | 189 | ||
187 | /* the user needs to delete it */ | 190 | /* the user needs to delete it */ |
188 | DocLnk selectedDocument()const; | 191 | DocLnk selectedDocument()const; |
189 | /* the user needs to delete it */ | 192 | /* the user needs to delete it */ |
190 | QValueList<DocLnk> selectedDocuments()const; | 193 | QValueList<DocLnk> selectedDocuments()const; |
191 | 194 | ||
192 | signals: | 195 | signals: |
193 | void fileSelected( const DocLnk & ); | 196 | void fileSelected( const DocLnk & ); |
194 | void fileSelected( const QString & ); | 197 | void fileSelected( const QString & ); |
195 | void dirSelected(const QString &dir ); | 198 | void dirSelected(const QString &dir ); |
196 | void closeMe(); | 199 | void closeMe(); |
197 | void ok(); | 200 | void ok(); |
198 | void cancel(); | 201 | void cancel(); |
199 | void contextMenu(); | 202 | void contextMenu(); |
200 | 203 | ||
201 | private slots: | 204 | private slots: |
202 | void slotTest() { qWarning("slotTest" ); setLineEditVisible(false ); }; | 205 | void slotTest() { qWarning("slotTest" ); setLineEditVisible(false ); }; |
203 | void slotOk(); | 206 | void slotOk(); |
204 | void slotCancel(); | 207 | void slotCancel(); |
205 | void slotViewCheck(const QString & ); | 208 | void slotViewCheck(const QString & ); |
206 | void slotMimeCheck(const QString & ); | 209 | void slotMimeCheck(const QString & ); |
207 | void slotLocationActivated(const QString & ); | 210 | void slotLocationActivated(const QString & ); |
208 | void slotInsertLocationPath(const QString &, int); | 211 | void slotInsertLocationPath(const QString &, int); |
209 | void locationComboChanged(); | 212 | void locationComboChanged(); |
210 | 213 | ||
211 | private: | 214 | private: |
212 | void init(); | 215 | void init(); |
213 | void updateMimes(); | 216 | void updateMimes(); |
214 | 217 | ||
215 | protected: | 218 | protected: |
216 | 219 | ||
217 | private: | 220 | private: |
218 | int m_mode, m_selector; | 221 | int m_mode, m_selector; |
219 | QComboBox *m_location, *m_mimeCheck, *m_viewCheck; | 222 | QComboBox *m_location, *m_mimeCheck, *m_viewCheck; |
220 | QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; | 223 | QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; |
221 | QPushButton *m_reread, *m_up, *m_new, *m_close; | 224 | QPushButton *m_reread, *m_up, *m_new, *m_close; |
222 | QListView *m_View; | 225 | QListView *m_View; |
223 | QCheckBox *m_checkPerm; | 226 | QCheckBox *m_checkPerm; |
224 | QWidget *m_pseudo; | 227 | QWidget *m_pseudo; |
225 | QVBoxLayout *m_pseudoLayout; | 228 | QVBoxLayout *m_pseudoLayout; |
226 | 229 | ||
227 | QString m_currentDir; | 230 | QString m_currentDir; |
228 | QString m_name; | 231 | QString m_name; |
229 | // QStringList m_mimetypes; | 232 | // QStringList m_mimetypes; |
230 | QMap<QString, QStringList> m_mimetypes; | 233 | QMap<QString, QStringList> m_mimetypes; |
231 | 234 | ||
232 | FileSelector *m_select; | 235 | FileSelector *m_select; |
233 | QWidgetStack *m_stack; | 236 | QWidgetStack *m_stack; |
234 | QVBoxLayout *m_lay; | 237 | QVBoxLayout *m_lay; |
235 | QGridLayout *m_Oselector; | 238 | QGridLayout *m_Oselector; |
236 | 239 | ||
237 | QHBox *m_boxToolbar; | 240 | QHBox *m_boxToolbar; |
238 | QHBox *m_boxOk; // (no layout anymore) wait | 241 | QHBox *m_boxOk; // (no layout anymore) wait |
239 | QHBox *m_boxName; // (no Layout anymore) wait | 242 | QHBox *m_boxName; // (no Layout anymore) wait |
240 | QHBox *m_boxView; | 243 | QHBox *m_boxView; |
241 | 244 | ||
242 | QPopupMenu *m_custom; | 245 | QPopupMenu *m_custom; |
243 | 246 | ||
244 | QLineEdit *m_edit; | 247 | QLineEdit *m_edit; |
245 | QLabel *m_fnLabel; | 248 | QLabel *m_fnLabel; |
246 | 249 | ||
247 | bool m_shClose : 1; | 250 | bool m_shClose : 1; |
248 | bool m_shNew : 1; | 251 | bool m_shNew : 1; |
249 | bool m_shTool : 1; | 252 | bool m_shTool : 1; |
250 | bool m_shPerm : 1; | 253 | bool m_shPerm : 1; |
251 | bool m_shLne : 1; | 254 | bool m_shLne : 1; |
252 | bool m_shChooser : 1; | 255 | bool m_shChooser : 1; |
253 | bool m_shYesNo : 1; | 256 | bool m_shYesNo : 1; |
254 | bool m_boCheckPerm : 1; | 257 | bool m_boCheckPerm : 1; |
255 | bool m_autoMime : 1; | 258 | bool m_autoMime : 1; |
256 | bool m_case : 1; | 259 | bool m_case : 1; |
257 | bool m_dir : 1; | 260 | bool m_dir : 1; |
258 | bool m_files : 1; | 261 | bool m_files : 1; |
259 | bool m_showPopup : 1; | 262 | bool m_showPopup : 1; |
260 | 263 | ||
261 | void initVars(); | 264 | void initVars(); |
262 | virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE ); | 265 | virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE ); |
263 | virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE ); | 266 | virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE ); |
diff --git a/libopie/ofontselector.h b/libopie/ofontselector.h index 95ffd04..b819c45 100644 --- a/libopie/ofontselector.h +++ b/libopie/ofontselector.h | |||
@@ -1,93 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
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 | #ifndef OPIE_FONTSELECTOR_H__ | 29 | #ifndef OPIE_FONTSELECTOR_H__ |
30 | #define OPIE_FONTSELECTOR_H__ | 30 | #define OPIE_FONTSELECTOR_H__ |
31 | 31 | ||
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | class QListBox; | 34 | class QListBox; |
35 | class OFontSelectorPrivate; | 35 | class OFontSelectorPrivate; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * This class lets you chose a Font out of a list of Fonts. | 38 | * This class lets you chose a Font out of a list of Fonts. |
39 | * It can show a preview too. This selector will use all available | 39 | * It can show a preview too. This selector will use all available |
40 | * fonts | 40 | * fonts |
41 | * | 41 | * |
42 | * | 42 | * |
43 | * @short A widget to select a font | 43 | * @short A widget to select a font |
44 | * @see QWidget | 44 | * @see QWidget |
45 | * @see QFont | 45 | * @see QFont |
46 | * @author Rober Griebl | 46 | * @author Rober Griebl |
47 | */ | 47 | */ |
48 | class OFontSelector : public QWidget | 48 | class OFontSelector : public QWidget |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 53 | OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
54 | virtual ~OFontSelector ( ); | 54 | virtual ~OFontSelector ( ); |
55 | 55 | ||
56 | bool selectedFont ( QString &family, QString &style, int &size ); | 56 | bool selectedFont ( QString &family, QString &style, int &size ); |
57 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); | 57 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); |
58 | 58 | ||
59 | QFont selectedFont ( ); | 59 | QFont selectedFont ( ); |
60 | 60 | ||
61 | bool setSelectedFont ( const QFont & ); | 61 | bool setSelectedFont ( const QFont & ); |
62 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); | 62 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); |
63 | 63 | ||
64 | QString fontFamily ( ) const; | 64 | QString fontFamily ( ) const; |
65 | QString fontStyle ( ) const; | 65 | QString fontStyle ( ) const; |
66 | int fontSize ( ) const; | 66 | int fontSize ( ) const; |
67 | QString fontCharSet ( ) const; | 67 | QString fontCharSet ( ) const; |
68 | 68 | ||
69 | signals: | 69 | signals: |
70 | /** | 70 | /** |
71 | * This signal gets emitted when a font got chosen | 71 | * This signal gets emitted when a font got chosen |
72 | */ | 72 | */ |
73 | void fontSelected ( const QFont & ); | 73 | void fontSelected ( const QFont & ); |
74 | 74 | ||
75 | protected slots: | 75 | protected slots: |
76 | /** @internal */ | ||
76 | virtual void fontFamilyClicked ( int ); | 77 | virtual void fontFamilyClicked ( int ); |
78 | /** @internal */ | ||
77 | virtual void fontStyleClicked ( int ); | 79 | virtual void fontStyleClicked ( int ); |
80 | /** @internal */ | ||
78 | virtual void fontSizeClicked ( int ); | 81 | virtual void fontSizeClicked ( int ); |
79 | 82 | ||
80 | protected: | 83 | protected: |
81 | virtual void resizeEvent ( QResizeEvent *re ); | 84 | virtual void resizeEvent ( QResizeEvent *re ); |
82 | 85 | ||
83 | private: | 86 | private: |
84 | void loadFonts ( QListBox * ); | 87 | void loadFonts ( QListBox * ); |
85 | 88 | ||
86 | void changeFont ( ); | 89 | void changeFont ( ); |
87 | 90 | ||
88 | private: | 91 | private: |
89 | OFontSelectorPrivate *d; | 92 | OFontSelectorPrivate *d; |
90 | }; | 93 | }; |
91 | 94 | ||
92 | #endif | 95 | #endif |
93 | 96 | ||
diff --git a/libopie/oprocess.h b/libopie/oprocess.h index bf5fe0e..f2853b0 100644 --- a/libopie/oprocess.h +++ b/libopie/oprocess.h | |||
@@ -1,747 +1,753 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) | 2 | Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | // | 19 | // |
20 | // KPROCESS -- A class for handling child processes in KDE without | 20 | // KPROCESS -- A class for handling child processes in KDE without |
21 | // having to take care of Un*x specific implementation details | 21 | // having to take care of Un*x specific implementation details |
22 | // | 22 | // |
23 | // version 0.3.1, Jan 8th 1998 | 23 | // version 0.3.1, Jan 8th 1998 |
24 | // | 24 | // |
25 | // (C) Christian Czezatke | 25 | // (C) Christian Czezatke |
26 | // e9025461@student.tuwien.ac.at | 26 | // e9025461@student.tuwien.ac.at |
27 | // Ported by Holger Freyther to the Open Palmtop Integrated Environment | 27 | // Ported by Holger Freyther to the Open Palmtop Integrated Environment |
28 | // | 28 | // |
29 | 29 | ||
30 | #ifndef __kprocess_h__ | 30 | #ifndef __kprocess_h__ |
31 | #define __kprocess_h__ | 31 | #define __kprocess_h__ |
32 | 32 | ||
33 | #include <sys/types.h> // for pid_t | 33 | #include <sys/types.h> // for pid_t |
34 | #include <sys/wait.h> | 34 | #include <sys/wait.h> |
35 | #include <signal.h> | 35 | #include <signal.h> |
36 | #include <unistd.h> | 36 | #include <unistd.h> |
37 | #include <qvaluelist.h> | 37 | #include <qvaluelist.h> |
38 | #include <qcstring.h> | 38 | #include <qcstring.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | 40 | ||
41 | class QSocketNotifier; | 41 | class QSocketNotifier; |
42 | class OProcessPrivate; | 42 | class OProcessPrivate; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Child process invocation, monitoring and control. | 45 | * Child process invocation, monitoring and control. |
46 | * | 46 | * |
47 | * @sect General usage and features | 47 | * @sect General usage and features |
48 | * | 48 | * |
49 | *This class allows a KDE application to start child processes without having | 49 | *This class allows a KDE and OPIE application to start child processes without having |
50 | *to worry about UN*X signal handling issues and zombie process reaping. | 50 | *to worry about UN*X signal handling issues and zombie process reaping. |
51 | * | 51 | * |
52 | *@see KProcIO | 52 | *@see KProcIO |
53 | * | 53 | * |
54 | *Basically, this class distinguishes three different ways of running | 54 | *Basically, this class distinguishes three different ways of running |
55 | *child processes: | 55 | *child processes: |
56 | * | 56 | * |
57 | *@li OProcess::DontCare -- The child process is invoked and both the child | 57 | *@li OProcess::DontCare -- The child process is invoked and both the child |
58 | *process and the parent process continue concurrently. | 58 | *process and the parent process continue concurrently. |
59 | * | 59 | * |
60 | *Starting a DontCare child process means that the application is | 60 | *Starting a DontCare child process means that the application is |
61 | *not interested in any notification to determine whether the | 61 | *not interested in any notification to determine whether the |
62 | *child process has already exited or not. | 62 | *child process has already exited or not. |
63 | * | 63 | * |
64 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the | 64 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the |
65 | *child and the parent process run concurrently. | 65 | *child and the parent process run concurrently. |
66 | * | 66 | * |
67 | *When the child process exits, the OProcess instance | 67 | *When the child process exits, the OProcess instance |
68 | *corresponding to it emits the Qt signal @ref processExited(). | 68 | *corresponding to it emits the Qt signal @ref processExited(). |
69 | * | 69 | * |
70 | *Since this signal is @em not emitted from within a UN*X | 70 | *Since this signal is @em not emitted from within a UN*X |
71 | *signal handler, arbitrary function calls can be made. | 71 | *signal handler, arbitrary function calls can be made. |
72 | * | 72 | * |
73 | *Be aware: When the OProcess objects gets destructed, the child | 73 | *Be aware: When the OProcess objects gets destructed, the child |
74 | *process will be killed if it is still running! | 74 | *process will be killed if it is still running! |
75 | *This means in particular, that you cannot use a OProcess on the stack | 75 | *This means in particular, that you cannot use a OProcess on the stack |
76 | *with OProcess::NotifyOnExit. | 76 | *with OProcess::NotifyOnExit. |
77 | * | 77 | * |
78 | *@li OProcess::Block -- The child process starts and the parent process | 78 | *@li OProcess::Block -- The child process starts and the parent process |
79 | *is suspended until the child process exits. (@em Really not recommended | 79 | *is suspended until the child process exits. (@em Really not recommended |
80 | *for programs with a GUI.) | 80 | *for programs with a GUI.) |
81 | * | 81 | * |
82 | *OProcess also provides several functions for determining the exit status | 82 | *OProcess also provides several functions for determining the exit status |
83 | *and the pid of the child process it represents. | 83 | *and the pid of the child process it represents. |
84 | * | 84 | * |
85 | *Furthermore it is possible to supply command-line arguments to the process | 85 | *Furthermore it is possible to supply command-line arguments to the process |
86 | *in a clean fashion (no null -- terminated stringlists and such...) | 86 | *in a clean fashion (no null -- terminated stringlists and such...) |
87 | * | 87 | * |
88 | *A small usage example: | 88 | *A small usage example: |
89 | *<pre> | 89 | *<pre> |
90 | *OProcess *proc = new OProcess; | 90 | *OProcess *proc = new OProcess; |
91 | * | 91 | * |
92 | **proc << "my_executable"; | 92 | **proc << "my_executable"; |
93 | **proc << "These" << "are" << "the" << "command" << "line" << "args"; | 93 | **proc << "These" << "are" << "the" << "command" << "line" << "args"; |
94 | *QApplication::connect(proc, SIGNAL(processExited(OProcess *)), | 94 | *QApplication::connect(proc, SIGNAL(processExited(OProcess *)), |
95 | * pointer_to_my_object, SLOT(my_objects_slot(OProcess *))); | 95 | * pointer_to_my_object, SLOT(my_objects_slot(OProcess *))); |
96 | *proc->start(); | 96 | *proc->start(); |
97 | *</pre> | 97 | *</pre> |
98 | * | 98 | * |
99 | *This will start "my_executable" with the commandline arguments "These"... | 99 | *This will start "my_executable" with the commandline arguments "These"... |
100 | * | 100 | * |
101 | *When the child process exits, the respective Qt signal will be emitted. | 101 | *When the child process exits, the respective Qt signal will be emitted. |
102 | * | 102 | * |
103 | *@sect Communication with the child process | 103 | *@sect Communication with the child process |
104 | * | 104 | * |
105 | *OProcess supports communication with the child process through | 105 | *OProcess supports communication with the child process through |
106 | *stdin/stdout/stderr. | 106 | *stdin/stdout/stderr. |
107 | * | 107 | * |
108 | *The following functions are provided for getting data from the child | 108 | *The following functions are provided for getting data from the child |
109 | *process or sending data to the child's stdin (For more information, | 109 | *process or sending data to the child's stdin (For more information, |
110 | *have a look at the documentation of each function): | 110 | *have a look at the documentation of each function): |
111 | * | 111 | * |
112 | *@li bool @ref writeStdin(char *buffer, int buflen); | 112 | *@li bool @ref writeStdin(char *buffer, int buflen); |
113 | *@li -- Transmit data to the child process's stdin. | 113 | *@li -- Transmit data to the child process's stdin. |
114 | * | 114 | * |
115 | *@li bool @ref closeStdin(); | 115 | *@li bool @ref closeStdin(); |
116 | *@li -- Closes the child process's stdin (which causes it to see an feof(stdin)). | 116 | *@li -- Closes the child process's stdin (which causes it to see an feof(stdin)). |
117 | *Returns false if you try to close stdin for a process that has been started | 117 | *Returns false if you try to close stdin for a process that has been started |
118 | *without a communication channel to stdin. | 118 | *without a communication channel to stdin. |
119 | * | 119 | * |
120 | *@li bool @ref closeStdout(); | 120 | *@li bool @ref closeStdout(); |
121 | *@li -- Closes the child process's stdout. | 121 | *@li -- Closes the child process's stdout. |
122 | *Returns false if you try to close stdout for a process that has been started | 122 | *Returns false if you try to close stdout for a process that has been started |
123 | *without a communication channel to stdout. | 123 | *without a communication channel to stdout. |
124 | * | 124 | * |
125 | *@li bool @ref closeStderr(); | 125 | *@li bool @ref closeStderr(); |
126 | *@li -- Closes the child process's stderr. | 126 | *@li -- Closes the child process's stderr. |
127 | *Returns false if you try to close stderr for a process that has been started | 127 | *Returns false if you try to close stderr for a process that has been started |
128 | *without a communication channel to stderr. | 128 | *without a communication channel to stderr. |
129 | * | 129 | * |
130 | * | 130 | * |
131 | *@sect QT signals: | 131 | *@sect QT signals: |
132 | * | 132 | * |
133 | *@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen); | 133 | *@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen); |
134 | *@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen); | 134 | *@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen); |
135 | *@li -- Indicates that new data has arrived from either the | 135 | *@li -- Indicates that new data has arrived from either the |
136 | *child process's stdout or stderr. | 136 | *child process's stdout or stderr. |
137 | * | 137 | * |
138 | *@li void @ref wroteStdin(OProcess *proc); | 138 | *@li void @ref wroteStdin(OProcess *proc); |
139 | *@li -- Indicates that all data that has been sent to the child process | 139 | *@li -- Indicates that all data that has been sent to the child process |
140 | *by a prior call to @ref writeStdin() has actually been transmitted to the | 140 | *by a prior call to @ref writeStdin() has actually been transmitted to the |
141 | *client . | 141 | *client . |
142 | * | 142 | * |
143 | *@author Christian Czezakte e9025461@student.tuwien.ac.at | 143 | *@author Christian Czezakte e9025461@student.tuwien.ac.at |
144 | * | 144 | * |
145 | * | 145 | * |
146 | **/ | 146 | **/ |
147 | class OProcess : public QObject | 147 | class OProcess : public QObject |
148 | { | 148 | { |
149 | Q_OBJECT | 149 | Q_OBJECT |
150 | 150 | ||
151 | public: | 151 | public: |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Modes in which the communication channel can be opened. | 154 | * Modes in which the communication channel can be opened. |
155 | * | 155 | * |
156 | * If communication for more than one channel is required, | 156 | * If communication for more than one channel is required, |
157 | * the values have to be or'ed together, for example to get | 157 | * the values have to be or'ed together, for example to get |
158 | * communication with stdout as well as with stdin, you would | 158 | * communication with stdout as well as with stdin, you would |
159 | * specify @p Stdin @p | @p Stdout | 159 | * specify @p Stdin @p | @p Stdout |
160 | * | 160 | * |
161 | * If @p NoRead is specified in conjunction with @p Stdout, | 161 | * If @p NoRead is specified in conjunction with @p Stdout, |
162 | * no data is actually read from @p Stdout but only | 162 | * no data is actually read from @p Stdout but only |
163 | * the signal @ref childOutput(int fd) is emitted. | 163 | * the signal @ref childOutput(int fd) is emitted. |
164 | */ | 164 | */ |
165 | enum Communication { NoCommunication = 0, Stdin = 1, Stdout = 2, Stderr = 4, | 165 | enum Communication { NoCommunication = 0, Stdin = 1, Stdout = 2, Stderr = 4, |
166 | AllOutput = 6, All = 7, | 166 | AllOutput = 6, All = 7, |
167 | NoRead }; | 167 | NoRead }; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Run-modes for a child process. | 170 | * Run-modes for a child process. |
171 | */ | 171 | */ |
172 | enum RunMode { | 172 | enum RunMode { |
173 | /** | 173 | /** |
174 | * The application does not receive notifications from the subprocess when | 174 | * The application does not receive notifications from the subprocess when |
175 | * it is finished or aborted. | 175 | * it is finished or aborted. |
176 | */ | 176 | */ |
177 | DontCare, | 177 | DontCare, |
178 | /** | 178 | /** |
179 | * The application is notified when the subprocess dies. | 179 | * The application is notified when the subprocess dies. |
180 | */ | 180 | */ |
181 | NotifyOnExit, | 181 | NotifyOnExit, |
182 | /** | 182 | /** |
183 | * The application is suspended until the started process is finished. | 183 | * The application is suspended until the started process is finished. |
184 | */ | 184 | */ |
185 | Block }; | 185 | Block }; |
186 | 186 | ||
187 | /** | 187 | /** |
188 | * Constructor | 188 | * Constructor |
189 | */ | 189 | */ |
190 | OProcess(QObject *parent = 0, const char *name = 0); | 190 | OProcess(QObject *parent = 0, const char *name = 0); |
191 | /** | ||
192 | * Constructor | ||
193 | */ | ||
191 | OProcess(const QString &arg0, QObject *parent = 0, const char *name = 0); | 194 | OProcess(const QString &arg0, QObject *parent = 0, const char *name = 0); |
195 | /** | ||
196 | * Constructor | ||
197 | */ | ||
192 | OProcess(const QStringList &args, QObject *parent = 0, const char *name = 0); | 198 | OProcess(const QStringList &args, QObject *parent = 0, const char *name = 0); |
193 | 199 | ||
194 | /** | 200 | /** |
195 | *Destructor: | 201 | *Destructor: |
196 | * | 202 | * |
197 | * If the process is running when the destructor for this class | 203 | * If the process is running when the destructor for this class |
198 | * is called, the child process is killed with a SIGKILL, but | 204 | * is called, the child process is killed with a SIGKILL, but |
199 | * only if the run mode is not of type @p DontCare. | 205 | * only if the run mode is not of type @p DontCare. |
200 | * Processes started as @p DontCare keep running anyway. | 206 | * Processes started as @p DontCare keep running anyway. |
201 | */ | 207 | */ |
202 | virtual ~OProcess(); | 208 | virtual ~OProcess(); |
203 | 209 | ||
204 | /** | 210 | /** |
205 | @deprecated | 211 | @deprecated |
206 | 212 | ||
207 | The use of this function is now deprecated. -- Please use the | 213 | The use of this function is now deprecated. -- Please use the |
208 | "operator<<" instead of "setExecutable". | 214 | "operator<<" instead of "setExecutable". |
209 | 215 | ||
210 | Sets the executable to be started with this OProcess object. | 216 | Sets the executable to be started with this OProcess object. |
211 | Returns false if the process is currently running (in that | 217 | Returns false if the process is currently running (in that |
212 | case the executable remains unchanged.) | 218 | case the executable remains unchanged.) |
213 | 219 | ||
214 | @see operator<< | 220 | @see operator<< |
215 | 221 | ||
216 | */ | 222 | */ |
217 | bool setExecutable(const QString& proc); | 223 | bool setExecutable(const QString& proc); |
218 | 224 | ||
219 | 225 | ||
220 | /** | 226 | /** |
221 | * Sets the executable and the command line argument list for this process. | 227 | * Sets the executable and the command line argument list for this process. |
222 | * | 228 | * |
223 | * For example, doing an "ls -l /usr/local/bin" can be achieved by: | 229 | * For example, doing an "ls -l /usr/local/bin" can be achieved by: |
224 | * <pre> | 230 | * <pre> |
225 | * OProcess p; | 231 | * OProcess p; |
226 | * ... | 232 | * ... |
227 | * p << "ls" << "-l" << "/usr/local/bin" | 233 | * p << "ls" << "-l" << "/usr/local/bin" |
228 | * </pre> | 234 | * </pre> |
229 | * | 235 | * |
230 | **/ | 236 | **/ |
231 | OProcess &operator<<(const QString& arg); | 237 | OProcess &operator<<(const QString& arg); |
232 | /** | 238 | /** |
233 | * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. | 239 | * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. |
234 | */ | 240 | */ |
235 | OProcess &operator<<(const char * arg); | 241 | OProcess &operator<<(const char * arg); |
236 | /** | 242 | /** |
237 | * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. | 243 | * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. |
238 | */ | 244 | */ |
239 | OProcess &operator<<(const QCString & arg); | 245 | OProcess &operator<<(const QCString & arg); |
240 | 246 | ||
241 | /** | 247 | /** |
242 | * Sets the executable and the command line argument list for this process, | 248 | * Sets the executable and the command line argument list for this process, |
243 | * in a single method call, or add a list of arguments. | 249 | * in a single method call, or add a list of arguments. |
244 | **/ | 250 | **/ |
245 | OProcess &operator<<(const QStringList& args); | 251 | OProcess &operator<<(const QStringList& args); |
246 | 252 | ||
247 | /** | 253 | /** |
248 | * Clear a command line argument list that has been set by using | 254 | * Clear a command line argument list that has been set by using |
249 | * the "operator<<". | 255 | * the "operator<<". |
250 | */ | 256 | */ |
251 | void clearArguments(); | 257 | void clearArguments(); |
252 | 258 | ||
253 | /** | 259 | /** |
254 | * Starts the process. | 260 | * Starts the process. |
255 | * For a detailed description of the | 261 | * For a detailed description of the |
256 | * various run modes and communication semantics, have a look at the | 262 | * various run modes and communication semantics, have a look at the |
257 | * general description of the OProcess class. | 263 | * general description of the OProcess class. |
258 | * | 264 | * |
259 | * The following problems could cause this function to | 265 | * The following problems could cause this function to |
260 | * return false: | 266 | * return false: |
261 | * | 267 | * |
262 | * @li The process is already running. | 268 | * @li The process is already running. |
263 | * @li The command line argument list is empty. | 269 | * @li The command line argument list is empty. |
264 | * @li The starting of the process failed (could not fork). | 270 | * @li The starting of the process failed (could not fork). |
265 | * @li The executable was not found. | 271 | * @li The executable was not found. |
266 | * | 272 | * |
267 | * @param comm Specifies which communication links should be | 273 | * @param comm Specifies which communication links should be |
268 | * established to the child process (stdin/stdout/stderr). By default, | 274 | * established to the child process (stdin/stdout/stderr). By default, |
269 | * no communication takes place and the respective communication | 275 | * no communication takes place and the respective communication |
270 | * signals will never get emitted. | 276 | * signals will never get emitted. |
271 | * | 277 | * |
272 | * @return true on success, false on error | 278 | * @return true on success, false on error |
273 | * (see above for error conditions) | 279 | * (see above for error conditions) |
274 | **/ | 280 | **/ |
275 | virtual bool start(RunMode runmode = NotifyOnExit, | 281 | virtual bool start(RunMode runmode = NotifyOnExit, |
276 | Communication comm = NoCommunication); | 282 | Communication comm = NoCommunication); |
277 | 283 | ||
278 | /** | 284 | /** |
279 | * Stop the process (by sending it a signal). | 285 | * Stop the process (by sending it a signal). |
280 | * | 286 | * |
281 | * @param signoThe signal to send. The default is SIGTERM. | 287 | * @param signoThe signal to send. The default is SIGTERM. |
282 | * @return @p true if the signal was delivered successfully. | 288 | * @return @p true if the signal was delivered successfully. |
283 | */ | 289 | */ |
284 | virtual bool kill(int signo = SIGTERM); | 290 | virtual bool kill(int signo = SIGTERM); |
285 | 291 | ||
286 | /** | 292 | /** |
287 | @return @p true if the process is (still) considered to be running | 293 | @return @p true if the process is (still) considered to be running |
288 | */ | 294 | */ |
289 | bool isRunning() const; | 295 | bool isRunning() const; |
290 | 296 | ||
291 | /** Returns the process id of the process. | 297 | /** Returns the process id of the process. |
292 | * | 298 | * |
293 | * If it is called after | 299 | * If it is called after |
294 | * the process has exited, it returns the process id of the last | 300 | * the process has exited, it returns the process id of the last |
295 | * child process that was created by this instance of OProcess. | 301 | * child process that was created by this instance of OProcess. |
296 | * | 302 | * |
297 | * Calling it before any child process has been started by this | 303 | * Calling it before any child process has been started by this |
298 | * OProcess instance causes pid() to return 0. | 304 | * OProcess instance causes pid() to return 0. |
299 | **/ | 305 | **/ |
300 | pid_t pid() const; | 306 | pid_t pid() const; |
301 | 307 | ||
302 | /** | 308 | /** |
303 | * Use pid(). | 309 | * Use pid(). |
304 | * @deprecated | 310 | * @deprecated |
305 | */ | 311 | */ |
306 | pid_t getPid() const { return pid(); } | 312 | pid_t getPid() const { return pid(); } |
307 | 313 | ||
308 | /** | 314 | /** |
309 | * Suspend processing of data from stdout of the child process. | 315 | * Suspend processing of data from stdout of the child process. |
310 | */ | 316 | */ |
311 | void suspend(); | 317 | void suspend(); |
312 | 318 | ||
313 | /** | 319 | /** |
314 | * Resume processing of data from stdout of the child process. | 320 | * Resume processing of data from stdout of the child process. |
315 | */ | 321 | */ |
316 | void resume(); | 322 | void resume(); |
317 | 323 | ||
318 | /** | 324 | /** |
319 | * @return @p true if the process has already finished and has exited | 325 | * @return @p true if the process has already finished and has exited |
320 | * "voluntarily", ie: it has not been killed by a signal. | 326 | * "voluntarily", ie: it has not been killed by a signal. |
321 | * | 327 | * |
322 | * Note that you should check @ref OProcess::exitStatus() to determine | 328 | * Note that you should check @ref OProcess::exitStatus() to determine |
323 | * whether the process completed its task successful or not. | 329 | * whether the process completed its task successful or not. |
324 | */ | 330 | */ |
325 | bool normalExit() const; | 331 | bool normalExit() const; |
326 | 332 | ||
327 | /** | 333 | /** |
328 | * Returns the exit status of the process. | 334 | * Returns the exit status of the process. |
329 | * | 335 | * |
330 | * Please use | 336 | * Please use |
331 | * @ref OProcess::normalExit() to check whether the process has exited | 337 | * @ref OProcess::normalExit() to check whether the process has exited |
332 | * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling | 338 | * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling |
333 | * this function because if the process did not exit normally, | 339 | * this function because if the process did not exit normally, |
334 | * it does not have a valid exit status. | 340 | * it does not have a valid exit status. |
335 | */ | 341 | */ |
336 | int exitStatus() const; | 342 | int exitStatus() const; |
337 | 343 | ||
338 | 344 | ||
339 | /** | 345 | /** |
340 | * Transmit data to the child process's stdin. | 346 | * Transmit data to the child process's stdin. |
341 | * | 347 | * |
342 | * OProcess::writeStdin may return false in the following cases: | 348 | * OProcess::writeStdin may return false in the following cases: |
343 | * | 349 | * |
344 | * @li The process is not currently running. | 350 | * @li The process is not currently running. |
345 | * | 351 | * |
346 | * @li Communication to stdin has not been requested in the @ref start() call. | 352 | * @li Communication to stdin has not been requested in the @ref start() call. |
347 | * | 353 | * |
348 | * @li Transmission of data to the child process by a previous call to | 354 | * @li Transmission of data to the child process by a previous call to |
349 | * @ref writeStdin() is still in progress. | 355 | * @ref writeStdin() is still in progress. |
350 | * | 356 | * |
351 | * Please note that the data is sent to the client asynchronously, | 357 | * Please note that the data is sent to the client asynchronously, |
352 | * so when this function returns, the data might not have been | 358 | * so when this function returns, the data might not have been |
353 | * processed by the child process. | 359 | * processed by the child process. |
354 | * | 360 | * |
355 | * If all the data has been sent to the client, the signal | 361 | * If all the data has been sent to the client, the signal |
356 | * @ref wroteStdin() will be emitted. | 362 | * @ref wroteStdin() will be emitted. |
357 | * | 363 | * |
358 | * Please note that you must not free "buffer" or call @ref writeStdin() | 364 | * Please note that you must not free "buffer" or call @ref writeStdin() |
359 | * again until either a @ref wroteStdin() signal indicates that the | 365 | * again until either a @ref wroteStdin() signal indicates that the |
360 | * data has been sent or a @ref processHasExited() signal shows that | 366 | * data has been sent or a @ref processHasExited() signal shows that |
361 | * the child process is no longer alive... | 367 | * the child process is no longer alive... |
362 | **/ | 368 | **/ |
363 | bool writeStdin(const char *buffer, int buflen); | 369 | bool writeStdin(const char *buffer, int buflen); |
364 | 370 | ||
365 | void flushStdin(); | 371 | void flushStdin(); |
366 | 372 | ||
367 | /** | 373 | /** |
368 | * This causes the stdin file descriptor of the child process to be | 374 | * This causes the stdin file descriptor of the child process to be |
369 | * closed indicating an "EOF" to the child. | 375 | * closed indicating an "EOF" to the child. |
370 | * | 376 | * |
371 | * @return @p false if no communication to the process's stdin | 377 | * @return @p false if no communication to the process's stdin |
372 | * had been specified in the call to @ref start(). | 378 | * had been specified in the call to @ref start(). |
373 | */ | 379 | */ |
374 | bool closeStdin(); | 380 | bool closeStdin(); |
375 | 381 | ||
376 | /** | 382 | /** |
377 | * This causes the stdout file descriptor of the child process to be | 383 | * This causes the stdout file descriptor of the child process to be |
378 | * closed. | 384 | * closed. |
379 | * | 385 | * |
380 | * @return @p false if no communication to the process's stdout | 386 | * @return @p false if no communication to the process's stdout |
381 | * had been specified in the call to @ref start(). | 387 | * had been specified in the call to @ref start(). |
382 | */ | 388 | */ |
383 | bool closeStdout(); | 389 | bool closeStdout(); |
384 | 390 | ||
385 | /** | 391 | /** |
386 | * This causes the stderr file descriptor of the child process to be | 392 | * This causes the stderr file descriptor of the child process to be |
387 | * closed. | 393 | * closed. |
388 | * | 394 | * |
389 | * @return @p false if no communication to the process's stderr | 395 | * @return @p false if no communication to the process's stderr |
390 | * had been specified in the call to @ref start(). | 396 | * had been specified in the call to @ref start(). |
391 | */ | 397 | */ |
392 | bool closeStderr(); | 398 | bool closeStderr(); |
393 | 399 | ||
394 | /** | 400 | /** |
395 | * Lets you see what your arguments are for debugging. | 401 | * Lets you see what your arguments are for debugging. |
396 | */ | 402 | */ |
397 | 403 | ||
398 | const QValueList<QCString> &args() { return arguments; } | 404 | const QValueList<QCString> &args() { return arguments; } |
399 | 405 | ||
400 | /** | 406 | /** |
401 | * Controls whether the started process should drop any | 407 | * Controls whether the started process should drop any |
402 | * setuid/segid privileges or whether it should keep them | 408 | * setuid/segid privileges or whether it should keep them |
403 | * | 409 | * |
404 | * The default is @p false : drop privileges | 410 | * The default is @p false : drop privileges |
405 | */ | 411 | */ |
406 | void setRunPrivileged(bool keepPrivileges); | 412 | void setRunPrivileged(bool keepPrivileges); |
407 | 413 | ||
408 | /** | 414 | /** |
409 | * Returns whether the started process will drop any | 415 | * Returns whether the started process will drop any |
410 | * setuid/segid privileges or whether it will keep them | 416 | * setuid/segid privileges or whether it will keep them |
411 | */ | 417 | */ |
412 | bool runPrivileged() const; | 418 | bool runPrivileged() const; |
413 | 419 | ||
414 | /** | 420 | /** |
415 | * Modifies the environment of the process to be started. | 421 | * Modifies the environment of the process to be started. |
416 | * This function must be called before starting the process. | 422 | * This function must be called before starting the process. |
417 | */ | 423 | */ |
418 | void setEnvironment(const QString &name, const QString &value); | 424 | void setEnvironment(const QString &name, const QString &value); |
419 | 425 | ||
420 | /** | 426 | /** |
421 | * Changes the current working directory (CWD) of the process | 427 | * Changes the current working directory (CWD) of the process |
422 | * to be started. | 428 | * to be started. |
423 | * This function must be called before starting the process. | 429 | * This function must be called before starting the process. |
424 | */ | 430 | */ |
425 | void setWorkingDirectory(const QString &dir); | 431 | void setWorkingDirectory(const QString &dir); |
426 | 432 | ||
427 | /** | 433 | /** |
428 | * Specify whether to start the command via a shell or directly. | 434 | * Specify whether to start the command via a shell or directly. |
429 | * The default is to start the command directly. | 435 | * The default is to start the command directly. |
430 | * If @p useShell is true @p shell will be used as shell, or | 436 | * If @p useShell is true @p shell will be used as shell, or |
431 | * if shell is empty, the standard shell is used. | 437 | * if shell is empty, the standard shell is used. |
432 | * @p quote A flag indicating whether to quote the arguments. | 438 | * @p quote A flag indicating whether to quote the arguments. |
433 | * | 439 | * |
434 | * When using a shell, the caller should make sure that all filenames etc. | 440 | * When using a shell, the caller should make sure that all filenames etc. |
435 | * are properly quoted when passed as argument. | 441 | * are properly quoted when passed as argument. |
436 | * @see quote() | 442 | * @see quote() |
437 | */ | 443 | */ |
438 | void setUseShell(bool useShell, const char *shell = 0); | 444 | void setUseShell(bool useShell, const char *shell = 0); |
439 | 445 | ||
440 | /** | 446 | /** |
441 | * This function can be used to quote an argument string such that | 447 | * This function can be used to quote an argument string such that |
442 | * the shell processes it properly. This is e. g. necessary for | 448 | * the shell processes it properly. This is e. g. necessary for |
443 | * user-provided file names which may contain spaces or quotes. | 449 | * user-provided file names which may contain spaces or quotes. |
444 | * It also prevents expansion of wild cards and environment variables. | 450 | * It also prevents expansion of wild cards and environment variables. |
445 | */ | 451 | */ |
446 | static QString quote(const QString &arg); | 452 | static QString quote(const QString &arg); |
447 | 453 | ||
448 | /** | 454 | /** |
449 | * Detaches OProcess from child process. All communication is closed. | 455 | * Detaches OProcess from child process. All communication is closed. |
450 | * No exit notification is emitted any more for the child process. | 456 | * No exit notification is emitted any more for the child process. |
451 | * Deleting the OProcess will no longer kill the child process. | 457 | * Deleting the OProcess will no longer kill the child process. |
452 | * Note that the current process remains the parent process of the | 458 | * Note that the current process remains the parent process of the |
453 | * child process. | 459 | * child process. |
454 | */ | 460 | */ |
455 | void detach(); | 461 | void detach(); |
456 | 462 | ||
457 | 463 | ||
458 | 464 | ||
459 | signals: | 465 | signals: |
460 | 466 | ||
461 | /** | 467 | /** |
462 | * Emitted after the process has terminated when | 468 | * Emitted after the process has terminated when |
463 | * the process was run in the @p NotifyOnExit (==default option to | 469 | * the process was run in the @p NotifyOnExit (==default option to |
464 | * @ref start()) or the @ref Block mode. | 470 | * @ref start()) or the @ref Block mode. |
465 | **/ | 471 | **/ |
466 | void processExited(OProcess *proc); | 472 | void processExited(OProcess *proc); |
467 | 473 | ||
468 | 474 | ||
469 | /** | 475 | /** |
470 | * Emitted, when output from the child process has | 476 | * Emitted, when output from the child process has |
471 | * been received on stdout. | 477 | * been received on stdout. |
472 | * | 478 | * |
473 | * To actually get | 479 | * To actually get |
474 | * these signals, the respective communication link (stdout/stderr) | 480 | * these signals, the respective communication link (stdout/stderr) |
475 | * has to be turned on in @ref start(). | 481 | * has to be turned on in @ref start(). |
476 | * | 482 | * |
477 | * @param buffer The data received. | 483 | * @param buffer The data received. |
478 | * @param buflen The number of bytes that are available. | 484 | * @param buflen The number of bytes that are available. |
479 | * | 485 | * |
480 | * You should copy the information contained in @p buffer to your private | 486 | * You should copy the information contained in @p buffer to your private |
481 | * data structures before returning from this slot. | 487 | * data structures before returning from this slot. |
482 | **/ | 488 | **/ |
483 | void receivedStdout(OProcess *proc, char *buffer, int buflen); | 489 | void receivedStdout(OProcess *proc, char *buffer, int buflen); |
484 | 490 | ||
485 | /** | 491 | /** |
486 | * Emitted when output from the child process has | 492 | * Emitted when output from the child process has |
487 | * been received on stdout. | 493 | * been received on stdout. |
488 | * | 494 | * |
489 | * To actually get these signals, the respective communications link | 495 | * To actually get these signals, the respective communications link |
490 | * (stdout/stderr) has to be turned on in @ref start() and the | 496 | * (stdout/stderr) has to be turned on in @ref start() and the |
491 | * @p NoRead flag should have been passed. | 497 | * @p NoRead flag should have been passed. |
492 | * | 498 | * |
493 | * You will need to explicitly call resume() after your call to start() | 499 | * You will need to explicitly call resume() after your call to start() |
494 | * to begin processing data from the child process's stdout. This is | 500 | * to begin processing data from the child process's stdout. This is |
495 | * to ensure that this signal is not emitted when no one is connected | 501 | * to ensure that this signal is not emitted when no one is connected |
496 | * to it, otherwise this signal will not be emitted. | 502 | * to it, otherwise this signal will not be emitted. |
497 | * | 503 | * |
498 | * The data still has to be read from file descriptor @p fd. | 504 | * The data still has to be read from file descriptor @p fd. |
499 | **/ | 505 | **/ |
500 | void receivedStdout(int fd, int &len); | 506 | void receivedStdout(int fd, int &len); |
501 | 507 | ||
502 | 508 | ||
503 | /** | 509 | /** |
504 | * Emitted, when output from the child process has | 510 | * Emitted, when output from the child process has |
505 | * been received on stderr. | 511 | * been received on stderr. |
506 | * To actually get | 512 | * To actually get |
507 | * these signals, the respective communication link (stdout/stderr) | 513 | * these signals, the respective communication link (stdout/stderr) |
508 | * has to be turned on in @ref start(). | 514 | * has to be turned on in @ref start(). |
509 | * | 515 | * |
510 | * @param buffer The data received. | 516 | * @param buffer The data received. |
511 | * @param buflen The number of bytes that are available. | 517 | * @param buflen The number of bytes that are available. |
512 | * | 518 | * |
513 | * You should copy the information contained in @p buffer to your private | 519 | * You should copy the information contained in @p buffer to your private |
514 | * data structures before returning from this slot. | 520 | * data structures before returning from this slot. |
515 | */ | 521 | */ |
516 | void receivedStderr(OProcess *proc, char *buffer, int buflen); | 522 | void receivedStderr(OProcess *proc, char *buffer, int buflen); |
517 | 523 | ||
518 | /** | 524 | /** |
519 | * Emitted after all the data that has been | 525 | * Emitted after all the data that has been |
520 | * specified by a prior call to @ref writeStdin() has actually been | 526 | * specified by a prior call to @ref writeStdin() has actually been |
521 | * written to the child process. | 527 | * written to the child process. |
522 | **/ | 528 | **/ |
523 | void wroteStdin(OProcess *proc); | 529 | void wroteStdin(OProcess *proc); |
524 | 530 | ||
525 | 531 | ||
526 | protected slots: | 532 | protected slots: |
527 | 533 | ||
528 | /** | 534 | /** |
529 | * This slot gets activated when data from the child's stdout arrives. | 535 | * This slot gets activated when data from the child's stdout arrives. |
530 | * It usually calls "childOutput" | 536 | * It usually calls "childOutput" |
531 | */ | 537 | */ |
532 | void slotChildOutput(int fdno); | 538 | void slotChildOutput(int fdno); |
533 | 539 | ||
534 | /** | 540 | /** |
535 | * This slot gets activated when data from the child's stderr arrives. | 541 | * This slot gets activated when data from the child's stderr arrives. |
536 | * It usually calls "childError" | 542 | * It usually calls "childError" |
537 | */ | 543 | */ |
538 | void slotChildError(int fdno); | 544 | void slotChildError(int fdno); |
539 | /* | 545 | /* |
540 | Slot functions for capturing stdout and stderr of the child | 546 | Slot functions for capturing stdout and stderr of the child |
541 | */ | 547 | */ |
542 | 548 | ||
543 | /** | 549 | /** |
544 | * Called when another bulk of data can be sent to the child's | 550 | * Called when another bulk of data can be sent to the child's |
545 | * stdin. If there is no more data to be sent to stdin currently | 551 | * stdin. If there is no more data to be sent to stdin currently |
546 | * available, this function must disable the QSocketNotifier "innot". | 552 | * available, this function must disable the QSocketNotifier "innot". |
547 | */ | 553 | */ |
548 | void slotSendData(int dummy); | 554 | void slotSendData(int dummy); |
549 | 555 | ||
550 | protected: | 556 | protected: |
551 | 557 | ||
552 | /** | 558 | /** |
553 | * Sets up the environment according to the data passed via | 559 | * Sets up the environment according to the data passed via |
554 | * setEnvironment(...) | 560 | * setEnvironment(...) |
555 | */ | 561 | */ |
556 | void setupEnvironment(); | 562 | void setupEnvironment(); |
557 | 563 | ||
558 | /** | 564 | /** |
559 | * The list of the process' command line arguments. The first entry | 565 | * The list of the process' command line arguments. The first entry |
560 | * in this list is the executable itself. | 566 | * in this list is the executable itself. |
561 | */ | 567 | */ |
562 | QValueList<QCString> arguments; | 568 | QValueList<QCString> arguments; |
563 | /** | 569 | /** |
564 | * How to run the process (Block, NotifyOnExit, DontCare). You should | 570 | * How to run the process (Block, NotifyOnExit, DontCare). You should |
565 | * not modify this data member directly from derived classes. | 571 | * not modify this data member directly from derived classes. |
566 | */ | 572 | */ |
567 | RunMode run_mode; | 573 | RunMode run_mode; |
568 | /** | 574 | /** |
569 | * true if the process is currently running. You should not | 575 | * true if the process is currently running. You should not |
570 | * modify this data member directly from derived classes. For | 576 | * modify this data member directly from derived classes. For |
571 | * reading the value of this data member, please use "isRunning()" | 577 | * reading the value of this data member, please use "isRunning()" |
572 | * since "runs" will probably be made private in later versions | 578 | * since "runs" will probably be made private in later versions |
573 | * of OProcess. | 579 | * of OProcess. |
574 | */ | 580 | */ |
575 | bool runs; | 581 | bool runs; |
576 | 582 | ||
577 | /** | 583 | /** |
578 | * The PID of the currently running process (see "getPid()"). | 584 | * The PID of the currently running process (see "getPid()"). |
579 | * You should not modify this data member in derived classes. | 585 | * You should not modify this data member in derived classes. |
580 | * Please use "getPid()" instead of directly accessing this | 586 | * Please use "getPid()" instead of directly accessing this |
581 | * member function since it will probably be made private in | 587 | * member function since it will probably be made private in |
582 | * later versions of OProcess. | 588 | * later versions of OProcess. |
583 | */ | 589 | */ |
584 | pid_t pid_; | 590 | pid_t pid_; |
585 | 591 | ||
586 | /** | 592 | /** |
587 | * The process' exit status as returned by "waitpid". You should not | 593 | * The process' exit status as returned by "waitpid". You should not |
588 | * modify the value of this data member from derived classes. You should | 594 | * modify the value of this data member from derived classes. You should |
589 | * rather use @ref exitStatus than accessing this data member directly | 595 | * rather use @ref exitStatus than accessing this data member directly |
590 | * since it will probably be made private in further versions of | 596 | * since it will probably be made private in further versions of |
591 | * OProcess. | 597 | * OProcess. |
592 | */ | 598 | */ |
593 | int status; | 599 | int status; |
594 | 600 | ||
595 | 601 | ||
596 | /** | 602 | /** |
597 | * See setRunPrivileged() | 603 | * See setRunPrivileged() |
598 | */ | 604 | */ |
599 | bool keepPrivs; | 605 | bool keepPrivs; |
600 | 606 | ||
601 | /* | 607 | /* |
602 | Functions for setting up the sockets for communication. | 608 | Functions for setting up the sockets for communication. |
603 | setupCommunication | 609 | setupCommunication |
604 | -- is called from "start" before "fork"ing. | 610 | -- is called from "start" before "fork"ing. |
605 | commSetupDoneP | 611 | commSetupDoneP |
606 | -- completes communication socket setup in the parent | 612 | -- completes communication socket setup in the parent |
607 | commSetupDoneC | 613 | commSetupDoneC |
608 | -- completes communication setup in the child process | 614 | -- completes communication setup in the child process |
609 | commClose | 615 | commClose |
610 | -- frees all allocated communication resources in the parent | 616 | -- frees all allocated communication resources in the parent |
611 | after the process has exited | 617 | after the process has exited |
612 | */ | 618 | */ |
613 | 619 | ||
614 | /** | 620 | /** |
615 | * This function is called from "OProcess::start" right before a "fork" takes | 621 | * This function is called from "OProcess::start" right before a "fork" takes |
616 | * place. According to | 622 | * place. According to |
617 | * the "comm" parameter this function has to initialize the "in", "out" and | 623 | * the "comm" parameter this function has to initialize the "in", "out" and |
618 | * "err" data member of OProcess. | 624 | * "err" data member of OProcess. |
619 | * | 625 | * |
620 | * This function should return 0 if setting the needed communication channels | 626 | * This function should return 0 if setting the needed communication channels |
621 | * was successful. | 627 | * was successful. |
622 | * | 628 | * |
623 | * The default implementation is to create UNIX STREAM sockets for the communication, | 629 | * The default implementation is to create UNIX STREAM sockets for the communication, |
624 | * but you could overload this function and establish a TCP/IP communication for | 630 | * but you could overload this function and establish a TCP/IP communication for |
625 | * network communication, for example. | 631 | * network communication, for example. |
626 | */ | 632 | */ |
627 | virtual int setupCommunication(Communication comm); | 633 | virtual int setupCommunication(Communication comm); |
628 | 634 | ||
629 | /** | 635 | /** |
630 | * Called right after a (successful) fork on the parent side. This function | 636 | * Called right after a (successful) fork on the parent side. This function |
631 | * will usually do some communications cleanup, like closing the reading end | 637 | * will usually do some communications cleanup, like closing the reading end |
632 | * of the "stdin" communication channel. | 638 | * of the "stdin" communication channel. |
633 | * | 639 | * |
634 | * Furthermore, it must also create the QSocketNotifiers "innot", "outnot" and | 640 | * Furthermore, it must also create the QSocketNotifiers "innot", "outnot" and |
635 | * "errnot" and connect their Qt slots to the respective OProcess member functions. | 641 | * "errnot" and connect their Qt slots to the respective OProcess member functions. |
636 | * | 642 | * |
637 | * For a more detailed explanation, it is best to have a look at the default | 643 | * For a more detailed explanation, it is best to have a look at the default |
638 | * implementation of "setupCommunication" in kprocess.cpp. | 644 | * implementation of "setupCommunication" in kprocess.cpp. |
639 | */ | 645 | */ |
640 | virtual int commSetupDoneP(); | 646 | virtual int commSetupDoneP(); |
641 | 647 | ||
642 | /** | 648 | /** |
643 | * Called right after a (successful) fork, but before an "exec" on the child | 649 | * Called right after a (successful) fork, but before an "exec" on the child |
644 | * process' side. It usually just closes the unused communication ends of | 650 | * process' side. It usually just closes the unused communication ends of |
645 | * "in", "out" and "err" (like the writing end of the "in" communication | 651 | * "in", "out" and "err" (like the writing end of the "in" communication |
646 | * channel. | 652 | * channel. |
647 | */ | 653 | */ |
648 | virtual int commSetupDoneC(); | 654 | virtual int commSetupDoneC(); |
649 | 655 | ||
650 | 656 | ||
651 | /** | 657 | /** |
652 | * Immediately called after a process has exited. This function normally | 658 | * Immediately called after a process has exited. This function normally |
653 | * calls commClose to close all open communication channels to this | 659 | * calls commClose to close all open communication channels to this |
654 | * process and emits the "processExited" signal (if the process was | 660 | * process and emits the "processExited" signal (if the process was |
655 | * not running in the "DontCare" mode). | 661 | * not running in the "DontCare" mode). |
656 | */ | 662 | */ |
657 | virtual void processHasExited(int state); | 663 | virtual void processHasExited(int state); |
658 | 664 | ||
659 | /** | 665 | /** |
660 | * Should clean up the communication links to the child after it has | 666 | * Should clean up the communication links to the child after it has |
661 | * exited. Should be called from "processHasExited". | 667 | * exited. Should be called from "processHasExited". |
662 | */ | 668 | */ |
663 | virtual void commClose(); | 669 | virtual void commClose(); |
664 | 670 | ||
665 | 671 | ||
666 | /** | 672 | /** |
667 | * the socket descriptors for stdin/stdout/stderr. | 673 | * the socket descriptors for stdin/stdout/stderr. |
668 | */ | 674 | */ |
669 | int out[2]; | 675 | int out[2]; |
670 | int in[2]; | 676 | int in[2]; |
671 | int err[2]; | 677 | int err[2]; |
672 | 678 | ||
673 | /** | 679 | /** |
674 | * The socket notifiers for the above socket descriptors. | 680 | * The socket notifiers for the above socket descriptors. |
675 | */ | 681 | */ |
676 | QSocketNotifier *innot; | 682 | QSocketNotifier *innot; |
677 | QSocketNotifier *outnot; | 683 | QSocketNotifier *outnot; |
678 | QSocketNotifier *errnot; | 684 | QSocketNotifier *errnot; |
679 | 685 | ||
680 | /** | 686 | /** |
681 | * Lists the communication links that are activated for the child | 687 | * Lists the communication links that are activated for the child |
682 | * process. Should not be modified from derived classes. | 688 | * process. Should not be modified from derived classes. |
683 | */ | 689 | */ |
684 | Communication communication; | 690 | Communication communication; |
685 | 691 | ||
686 | /** | 692 | /** |
687 | * Called by "slotChildOutput" this function copies data arriving from the | 693 | * Called by "slotChildOutput" this function copies data arriving from the |
688 | * child process's stdout to the respective buffer and emits the signal | 694 | * child process's stdout to the respective buffer and emits the signal |
689 | * "@ref receivedStderr". | 695 | * "@ref receivedStderr". |
690 | */ | 696 | */ |
691 | int childOutput(int fdno); | 697 | int childOutput(int fdno); |
692 | 698 | ||
693 | /** | 699 | /** |
694 | * Called by "slotChildOutput" this function copies data arriving from the | 700 | * Called by "slotChildOutput" this function copies data arriving from the |
695 | * child process's stdout to the respective buffer and emits the signal | 701 | * child process's stdout to the respective buffer and emits the signal |
696 | * "@ref receivedStderr" | 702 | * "@ref receivedStderr" |
697 | */ | 703 | */ |
698 | int childError(int fdno); | 704 | int childError(int fdno); |
699 | 705 | ||
700 | // information about the data that has to be sent to the child: | 706 | // information about the data that has to be sent to the child: |
701 | 707 | ||
702 | const char *input_data; // the buffer holding the data | 708 | const char *input_data; // the buffer holding the data |
703 | int input_sent; // # of bytes already transmitted | 709 | int input_sent; // # of bytes already transmitted |
704 | int input_total; // total length of input_data | 710 | int input_total; // total length of input_data |
705 | 711 | ||
706 | /** | 712 | /** |
707 | * @ref OProcessController is a friend of OProcess because it has to have | 713 | * @ref OProcessController is a friend of OProcess because it has to have |
708 | * access to various data members. | 714 | * access to various data members. |
709 | */ | 715 | */ |
710 | friend class OProcessController; | 716 | friend class OProcessController; |
711 | 717 | ||
712 | 718 | ||
713 | private: | 719 | private: |
714 | /** | 720 | /** |
715 | * Searches for a valid shell. | 721 | * Searches for a valid shell. |
716 | * Here is the algorithm used for finding an executable shell: | 722 | * Here is the algorithm used for finding an executable shell: |
717 | * | 723 | * |
718 | * @li Try the executable pointed to by the "SHELL" environment | 724 | * @li Try the executable pointed to by the "SHELL" environment |
719 | * variable with white spaces stripped off | 725 | * variable with white spaces stripped off |
720 | * | 726 | * |
721 | * @li If your process runs with uid != euid or gid != egid, a shell | 727 | * @li If your process runs with uid != euid or gid != egid, a shell |
722 | * not listed in /etc/shells will not used. | 728 | * not listed in /etc/shells will not used. |
723 | * | 729 | * |
724 | * @li If no valid shell could be found, "/bin/sh" is used as a last resort. | 730 | * @li If no valid shell could be found, "/bin/sh" is used as a last resort. |
725 | */ | 731 | */ |
726 | QCString searchShell(); | 732 | QCString searchShell(); |
727 | 733 | ||
728 | /** | 734 | /** |
729 | * Used by @ref searchShell in order to find out whether the shell found | 735 | * Used by @ref searchShell in order to find out whether the shell found |
730 | * is actually executable at all. | 736 | * is actually executable at all. |
731 | */ | 737 | */ |
732 | bool isExecutable(const QCString &filename); | 738 | bool isExecutable(const QCString &filename); |
733 | 739 | ||
734 | // Disallow assignment and copy-construction | 740 | // Disallow assignment and copy-construction |
735 | OProcess( const OProcess& ); | 741 | OProcess( const OProcess& ); |
736 | OProcess& operator= ( const OProcess& ); | 742 | OProcess& operator= ( const OProcess& ); |
737 | 743 | ||
738 | private: | 744 | private: |
739 | void init ( ); | 745 | void init ( ); |
740 | 746 | ||
741 | OProcessPrivate *d; | 747 | OProcessPrivate *d; |
742 | }; | 748 | }; |
743 | 749 | ||
744 | 750 | ||
745 | 751 | ||
746 | #endif | 752 | #endif |
747 | 753 | ||
diff --git a/libopie/orecurrancewidget.h b/libopie/orecurrancewidget.h index af87ce9..a5d6489 100644 --- a/libopie/orecurrancewidget.h +++ b/libopie/orecurrancewidget.h | |||
@@ -1,84 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | * GPL and based on the widget from TT | 2 | * GPL and based on the widget from TT |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef OPIE_RECURRANCE_WIDGET_H | 5 | #ifndef OPIE_RECURRANCE_WIDGET_H |
6 | #define OPIE_RECURRANCE_WIDGET_H | 6 | #define OPIE_RECURRANCE_WIDGET_H |
7 | 7 | ||
8 | #include <qlist.h> | 8 | #include <qlist.h> |
9 | #include <qtoolbutton.h> | 9 | #include <qtoolbutton.h> |
10 | #include <qcheckbox.h> | 10 | #include <qcheckbox.h> |
11 | #include <qdatetime.h> | 11 | #include <qdatetime.h> |
12 | #include <qbuttongroup.h> | 12 | #include <qbuttongroup.h> |
13 | 13 | ||
14 | #include <qpe/datebookmonth.h> | 14 | #include <qpe/datebookmonth.h> |
15 | 15 | ||
16 | #include "orecurrancebase.h" | 16 | #include "orecurrancebase.h" |
17 | #include <opie/orecur.h> | 17 | #include <opie/orecur.h> |
18 | 18 | ||
19 | // FIXME spelling!!!! -zecke | 19 | // FIXME spelling!!!! -zecke |
20 | // FIXME spelling filenames | 20 | // FIXME spelling filenames |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * A widget to let the user select rules for recurrences. | 23 | * A widget to let the user select rules for recurrences. |
24 | * This widget can take care of weekly, monthly, daily and yearly recurrence | 24 | * This widget can take care of weekly, monthly, daily and yearly recurrence |
25 | * It is used inside todolist and datebook. | 25 | * It is used inside todolist and datebook. |
26 | * | 26 | * |
27 | * | 27 | * |
28 | * @short Widget of selecting Recurrance | 28 | * @short Widget of selecting Recurrance |
29 | * @author Trolltech, Holger Freyther | 29 | * @author Trolltech, Holger Freyther |
30 | * @version 0.9 | 30 | * @version 0.9 |
31 | */ | 31 | */ |
32 | class ORecurranceWidget : public ORecurranceBase { | 32 | class ORecurranceWidget : public ORecurranceBase { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | public: | 34 | public: |
35 | ORecurranceWidget( bool startOnMonday, | 35 | ORecurranceWidget( bool startOnMonday, |
36 | const QDate& start, QWidget* parent = 0, | 36 | const QDate& start, QWidget* parent = 0, |
37 | const char* name = 0, bool modal = TRUE, | 37 | const char* name = 0, bool modal = TRUE, |
38 | WFlags fl = 0 ); | 38 | WFlags fl = 0 ); |
39 | ORecurranceWidget( bool startOnMonday, | 39 | ORecurranceWidget( bool startOnMonday, |
40 | const ORecur& rp, const QDate& start, | 40 | const ORecur& rp, const QDate& start, |
41 | QWidget* parent = 0, const char* name =0, | 41 | QWidget* parent = 0, const char* name =0, |
42 | bool modal = TRUE, WFlags = 0 ); | 42 | bool modal = TRUE, WFlags = 0 ); |
43 | ~ORecurranceWidget(); | 43 | ~ORecurranceWidget(); |
44 | ORecur recurrence()const; | 44 | ORecur recurrence()const; |
45 | QDate endDate()const; | 45 | QDate endDate()const; |
46 | 46 | ||
47 | public slots: | 47 | public slots: |
48 | void slotSetRType( int ); | 48 | void slotSetRType( int ); |
49 | /** | ||
50 | * set the new end date | ||
51 | */ | ||
49 | void endDateChanged( int, int, int ); | 52 | void endDateChanged( int, int, int ); |
53 | /** | ||
54 | * enable/disable end date | ||
55 | */ | ||
50 | void slotNoEnd( bool unused ); | 56 | void slotNoEnd( bool unused ); |
51 | void setStartDate( const QDate& ); | 57 | void setStartDate( const QDate& ); |
52 | void setRecurrence( const ORecur& recur, const QDate& start ); | 58 | void setRecurrence( const ORecur& recur, const QDate& start ); |
53 | void setRecurrence( const ORecur& recur ); | 59 | void setRecurrence( const ORecur& recur ); |
54 | 60 | ||
55 | private slots: | 61 | private slots: |
56 | void setupRepeatLabel( const QString& ); | 62 | void setupRepeatLabel( const QString& ); |
57 | void setupRepeatLabel( int ); | 63 | void setupRepeatLabel( int ); |
58 | void slotWeekLabel(); | 64 | void slotWeekLabel(); |
59 | void slotMonthLabel( int ); | 65 | void slotMonthLabel( int ); |
60 | void slotChangeStartOfWeek( bool onMonday ); | 66 | void slotChangeStartOfWeek( bool onMonday ); |
61 | 67 | ||
62 | private: | 68 | private: |
63 | void setupNone(); | 69 | void setupNone(); |
64 | void setupDaily(); | 70 | void setupDaily(); |
65 | void setupWeekly(); | 71 | void setupWeekly(); |
66 | void setupMonthly(); | 72 | void setupMonthly(); |
67 | void setupYearly(); | 73 | void setupYearly(); |
68 | 74 | ||
69 | enum repeatButtons { None, Day, Week, Month, Year }; | 75 | enum repeatButtons { None, Day, Week, Month, Year }; |
70 | void init(); | 76 | void init(); |
71 | void hideExtras(); | 77 | void hideExtras(); |
72 | void showRepeatStuff(); | 78 | void showRepeatStuff(); |
73 | 79 | ||
74 | QList<QToolButton> listRTypeButtons; | 80 | QList<QToolButton> listRTypeButtons; |
75 | QList<QToolButton> listExtra; | 81 | QList<QToolButton> listExtra; |
76 | QDate start; // only used in one spot... | 82 | QDate start; // only used in one spot... |
77 | QDate end; | 83 | QDate end; |
78 | repeatButtons currInterval; | 84 | repeatButtons currInterval; |
79 | bool startWeekOnMonday : 1; | 85 | bool startWeekOnMonday : 1; |
80 | DateBookMonth *repeatPicker; | 86 | DateBookMonth *repeatPicker; |
81 | 87 | ||
82 | }; | 88 | }; |
83 | 89 | ||
84 | #endif | 90 | #endif |
diff --git a/libopie/otabbar.h b/libopie/otabbar.h index c413611..0b353e2 100644 --- a/libopie/otabbar.h +++ b/libopie/otabbar.h | |||
@@ -1,76 +1,76 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
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 | #ifndef OTABBAR_H | 32 | #ifndef OTABBAR_H |
33 | #define OTABBAR_H | 33 | #define OTABBAR_H |
34 | 34 | ||
35 | #include <qtabbar.h> | 35 | #include <qtabbar.h> |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * @class OTabBar | 38 | * @class OTabBar |
39 | * @brief The OTabBar class is a derivative of QTabBar. | 39 | * @brief The OTabBar class is a derivative of QTabBar. |
40 | * | 40 | * |
41 | * OTabBar is a derivation of TrollTech's QTabBar which provides | 41 | * OTabBar is a derivation of TrollTech's QTabBar which provides |
42 | * a row of tabs for selection. The only difference between this | 42 | * a row of tabs for selection. The only difference between this |
43 | * class and QTabBar is that there is no dotted line box around | 43 | * class and QTabBar is that there is no dotted line box around |
44 | * the label of the tab with the current focus. | 44 | * the label of the tab with the current focus. |
45 | */ | 45 | */ |
46 | class OTabBar : public QTabBar | 46 | class OTabBar : public QTabBar |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | 49 | ||
50 | public: | 50 | public: |
51 | /** | 51 | /** |
52 | * @fn OTabBar( QWidget *parent = 0, const char *name = 0 ) | 52 | * @fn OTabBar( QWidget *parent = 0, const char *name = 0 ) |
53 | * @brief Object constructor. | 53 | * @brief Object constructor. |
54 | * | 54 | * |
55 | * @param parent Pointer to parent of this control. | 55 | * @param parent Pointer to parent of this control. |
56 | * @param name Name of control. | 56 | * @param name Name of control. |
57 | * | 57 | * |
58 | * Constructs a new OTabBar control with parent and name. | 58 | * Constructs a new OTabBar control with parent and name. |
59 | */ | 59 | */ |
60 | // FIXME Allow WFlags? -zecke | 60 | // FIXME Allow WFlags? -zecke |
61 | OTabBar( QWidget * = 0, const char * = 0 ); | 61 | OTabBar( QWidget * = 0, const char * = 0 ); |
62 | 62 | ||
63 | protected: | 63 | protected: |
64 | /** | 64 | /** |
65 | * @fn paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) | 65 | * @fn paintLabel( QPainter* p, const QRect& br , QTab* t, bool has_focus)const |
66 | * @brief Internal function to draw a tab's label. | 66 | * @brief Internal function to draw a tab's label. |
67 | * | 67 | * |
68 | * @param p Pointer to QPainter used for drawing. | 68 | * @param p Pointer to QPainter used for drawing. |
69 | * @param br QRect providing region to draw label in. | 69 | * @param br QRect providing region to draw label in. |
70 | * @param t Tab to draw label for. | 70 | * @param t Tab to draw label for. |
71 | * @param has_focus Boolean value not used, retained for compatibility reasons. | 71 | * @param has_focus Boolean value not used, retained for compatibility reasons. |
72 | */ | 72 | */ |
73 | void paintLabel( QPainter *, const QRect &, QTab *, bool ) const; | 73 | void paintLabel( QPainter *, const QRect &, QTab *, bool ) const; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/libopie/otabinfo.h b/libopie/otabinfo.h index 6589638..eebaf8e 100644 --- a/libopie/otabinfo.h +++ b/libopie/otabinfo.h | |||
@@ -1,132 +1,132 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
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 | #ifndef OTABINFO_H | 32 | #ifndef OTABINFO_H |
33 | #define OTABINFO_H | 33 | #define OTABINFO_H |
34 | 34 | ||
35 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | 37 | ||
38 | class QWidget; | 38 | class QWidget; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * @class OTabInfo | 41 | * @class OTabInfo |
42 | * @brief The OTabInfo class is used internally by OTabWidget to keep track | 42 | * @brief The OTabInfo class is used internally by OTabWidget to keep track |
43 | * of widgets added to the control. | 43 | * of widgets added to the control. |
44 | * | 44 | * |
45 | * OTabInfo provides the following information about a widget added to an | 45 | * OTabInfo provides the following information about a widget added to an |
46 | * OTabWidget control: | 46 | * OTabWidget control: |
47 | * | 47 | * |
48 | * ID - integer tab bar ID | 48 | * ID - integer tab bar ID |
49 | * Control - QWidget pointer to child widget | 49 | * Control - QWidget pointer to child widget |
50 | * Label - QString text label for OTabWidget selection control | 50 | * Label - QString text label for OTabWidget selection control |
51 | * Icon - QString name of icon file | 51 | * Icon - QString name of icon file |
52 | */ | 52 | */ |
53 | class OTabInfo | 53 | class OTabInfo |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | /** | 56 | /** |
57 | * @fn OTabInfo() | 57 | * @fn OTabInfo() |
58 | * @brief Object constructor. | 58 | * @brief Object constructor. |
59 | * | 59 | * |
60 | * @param parent Pointer to parent of this control. | 60 | * @param parent Pointer to parent of this control. |
61 | * @param name Name of control. | 61 | * @param name Name of control. |
62 | * @param s Style of widget selection control. | 62 | * @param s Style of widget selection control. |
63 | * @param p Position of the widget selection control. | 63 | * @param p Position of the widget selection control. |
64 | */ | 64 | */ |
65 | OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {} | 65 | OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {} |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) | 68 | * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) |
69 | * @brief Object constructor. | 69 | * @brief Object constructor. |
70 | * | 70 | * |
71 | * @param id TabBar identifier for widget. | 71 | * @param id TabBar identifier for widget. |
72 | * @param control QWidget pointer to widget. | 72 | * @param control QWidget pointer to widget. |
73 | * @param icon QString name of icon file. | 73 | * @param icon QString name of icon file. |
74 | * @param label QString text label for OTabWidget selection control. | 74 | * @param label QString text label for OTabWidget selection control. |
75 | */ | 75 | */ |
76 | OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) | 76 | OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) |
77 | : i( id ), c( control ), p( icon ), l( label ) {} | 77 | : i( id ), c( control ), p( icon ), l( label ) {} |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * @fn id() | 80 | * @fn id()const |
81 | * @brief Returns TabBar ID. | 81 | * @brief Returns TabBar ID. |
82 | */ | 82 | */ |
83 | int id() const { return i; } | 83 | int id() const { return i; } |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * @fn label() | 86 | * @fn label()const |
87 | * @brief Returns text label for widget. | 87 | * @brief Returns text label for widget. |
88 | */ | 88 | */ |
89 | const QString &label() const { return l; } | 89 | const QString &label() const { return l; } |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * @fn setLabel( const QString &label ) | 92 | * @fn setLabel( const QString &label ) |
93 | * @brief Set label for tab. | 93 | * @brief Set label for tab. |
94 | * | 94 | * |
95 | * @param label QString text label for OTabWidget selection control. | 95 | * @param label QString text label for OTabWidget selection control. |
96 | */ | 96 | */ |
97 | void setLabel( const QString &label ) { l = label; } | 97 | void setLabel( const QString &label ) { l = label; } |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * @fn control() | 100 | * @fn control()const |
101 | * @brief Returns pointer to widget. | 101 | * @brief Returns pointer to widget. |
102 | */ | 102 | */ |
103 | QWidget *control() const { return c; } | 103 | QWidget *control() const { return c; } |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * @fn icon() | 106 | * @fn icon()const |
107 | * @brief Returns name of icon file. | 107 | * @brief Returns name of icon file. |
108 | */ | 108 | */ |
109 | const QString &icon() const { return p; } | 109 | const QString &icon() const { return p; } |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * @fn setIcon( const QString &icon ) | 112 | * @fn setIcon( const QString &icon ) |
113 | * @brief Set icon for tab. | 113 | * @brief Set icon for tab. |
114 | * | 114 | * |
115 | * @param icon QString name of icon file. | 115 | * @param icon QString name of icon file. |
116 | */ | 116 | */ |
117 | void setIcon( const QString &icon ) { p = icon; } | 117 | void setIcon( const QString &icon ) { p = icon; } |
118 | 118 | ||
119 | private: | 119 | private: |
120 | int i; | 120 | int i; |
121 | QWidget *c; | 121 | QWidget *c; |
122 | QString p; | 122 | QString p; |
123 | QString l; | 123 | QString l; |
124 | }; | 124 | }; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * @class OTabInfoList | 127 | * @class OTabInfoList |
128 | * @brief A list of OTabInfo objects used by OTabWidget. | 128 | * @brief A list of OTabInfo objects used by OTabWidget. |
129 | */ | 129 | */ |
130 | typedef QList<OTabInfo> OTabInfoList; | 130 | typedef QList<OTabInfo> OTabInfoList; |
131 | 131 | ||
132 | #endif | 132 | #endif |
diff --git a/libopie/otabwidget.h b/libopie/otabwidget.h index bcd9a85..a67fe06 100644 --- a/libopie/otabwidget.h +++ b/libopie/otabwidget.h | |||
@@ -1,276 +1,276 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
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 | #ifndef OTABWIDGET_H | 32 | #ifndef OTABWIDGET_H |
33 | #define OTABWIDGET_H | 33 | #define OTABWIDGET_H |
34 | 34 | ||
35 | #include "otabinfo.h" | 35 | #include "otabinfo.h" |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qlist.h> | 38 | #include <qlist.h> |
39 | 39 | ||
40 | class OTabBar; | 40 | class OTabBar; |
41 | class QComboBox; | 41 | class QComboBox; |
42 | class QPixmap; | 42 | class QPixmap; |
43 | class QTabBar; | 43 | class QTabBar; |
44 | class QWidgetStack; | 44 | class QWidgetStack; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * @class OTabWidget | 47 | * @class OTabWidget |
48 | * @brief The OTabWidget class provides a stack of widgets. | 48 | * @brief The OTabWidget class provides a stack of widgets. |
49 | * | 49 | * |
50 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides | 50 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides |
51 | * a stack of widgets. Widgets can be selected using either a tab bar or | 51 | * a stack of widgets. Widgets can be selected using either a tab bar or |
52 | * drop down list box. | 52 | * drop down list box. |
53 | * | 53 | * |
54 | * The normal way to use OTabWidget is to do the following in the | 54 | * The normal way to use OTabWidget is to do the following in the |
55 | * constructor: | 55 | * constructor: |
56 | * - Create a OTabWidget. | 56 | * - Create a OTabWidget. |
57 | * - Create a QWidget for each of the pages in the control, insert | 57 | * - Create a QWidget for each of the pages in the control, insert |
58 | * children into it, set up geometry management for it, and use addTab() | 58 | * children into it, set up geometry management for it, and use addTab() |
59 | * to add the widget. | 59 | * to add the widget. |
60 | */ | 60 | */ |
61 | class OTabWidget : public QWidget | 61 | class OTabWidget : public QWidget |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * @enum TabStyle | 67 | * @enum TabStyle |
68 | * @brief Defines how the widget selection control is displayed. | 68 | * @brief Defines how the widget selection control is displayed. |
69 | * | 69 | * |
70 | * Valid values: | 70 | * Valid values: |
71 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) | 71 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) |
72 | * - TextTab: Tabbed widget selection with text labels | 72 | * - TextTab: Tabbed widget selection with text labels |
73 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget | 73 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget |
74 | * (similar to Opie launcher) | 74 | * (similar to Opie launcher) |
75 | * - TextList: Drop down list widget selection with text labels | 75 | * - TextList: Drop down list widget selection with text labels |
76 | * - IconList: Drop down list widget selection with icon & text labels | 76 | * - IconList: Drop down list widget selection with icon & text labels |
77 | */ | 77 | */ |
78 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; | 78 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * @enum TabPosition | 81 | * @enum TabPosition |
82 | * @brief Defines where the widget selection control is drawn. | 82 | * @brief Defines where the widget selection control is drawn. |
83 | * | 83 | * |
84 | * Valid values: | 84 | * Valid values: |
85 | * - Top: Widget selection control is drawn above widgets | 85 | * - Top: Widget selection control is drawn above widgets |
86 | * - Bottom: Widget selection control is drawn below widgets | 86 | * - Bottom: Widget selection control is drawn below widgets |
87 | */ | 87 | */ |
88 | enum TabPosition { Top, Bottom }; | 88 | enum TabPosition { Top, Bottom }; |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) | 91 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) |
92 | * @brief Object constructor. | 92 | * @brief Object constructor. |
93 | * | 93 | * |
94 | * @param parent Pointer to parent of this control. | 94 | * @param parent Pointer to parent of this control. |
95 | * @param name Name of control. | 95 | * @param name Name of control. |
96 | * @param s Style of widget selection control. | 96 | * @param s Style of widget selection control. |
97 | * @param p Position of the widget selection control. | 97 | * @param p Position of the widget selection control. |
98 | * | 98 | * |
99 | * Constructs a new OTabWidget control with parent and name. The style and position parameters | 99 | * Constructs a new OTabWidget control with parent and name. The style and position parameters |
100 | * determine how the widget selection control will be displayed. | 100 | * determine how the widget selection control will be displayed. |
101 | */ | 101 | */ |
102 | // FIXME WFlags? -zecke | 102 | // FIXME WFlags? -zecke |
103 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); | 103 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * @fn ~OTabWidget() | 106 | * @fn ~OTabWidget() |
107 | * @brief Object destructor. | 107 | * @brief Object destructor. |
108 | */ | 108 | */ |
109 | ~OTabWidget(); | 109 | ~OTabWidget(); |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) | 112 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) |
113 | * @brief Add new widget to control. | 113 | * @brief Add new widget to control. |
114 | * | 114 | * |
115 | * @param child Widget control. | 115 | * @param child Widget control. |
116 | * @param icon Path to icon. | 116 | * @param icon Path to icon. |
117 | * @param label Text label. | 117 | * @param label Text label. |
118 | */ | 118 | */ |
119 | void addTab( QWidget *, const QString &, const QString & ); | 119 | void addTab( QWidget *, const QString &, const QString & ); |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * @fn removePage( QWidget *widget ) | 122 | * @fn removePage( QWidget *widget ) |
123 | * @brief Remove widget from control. Does not delete widget. | 123 | * @brief Remove widget from control. Does not delete widget. |
124 | * | 124 | * |
125 | * @param widget Widget control to be removed. | 125 | * @param widget Widget control to be removed. |
126 | */ | 126 | */ |
127 | void removePage( QWidget * ); | 127 | void removePage( QWidget * ); |
128 | 128 | ||
129 | /** | 129 | /** |
130 | * @fn changeTab( QWidget *widget, const QIconSet &icon, const QString &label ) | 130 | * @fn changeTab( QWidget *widget, const QString &icon, const QString &label ) |
131 | * @brief Change text and/or icon for existing tab | 131 | * @brief Change text and/or icon for existing tab |
132 | * | 132 | * |
133 | * @param child Widget control. | 133 | * @param child Widget control. |
134 | * @param icon Path to icon. | 134 | * @param icon Path to icon. |
135 | * @param label Text label. | 135 | * @param label Text label. |
136 | */ | 136 | */ |
137 | void changeTab( QWidget *, const QString &, const QString & ); | 137 | void changeTab( QWidget *, const QString &, const QString & ); |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * @fn tabStyle() | 140 | * @fn tabStyle()const |
141 | * @brief Returns current widget selection control style. | 141 | * @brief Returns current widget selection control style. |
142 | */ | 142 | */ |
143 | TabStyle tabStyle() const; | 143 | TabStyle tabStyle() const; |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * @fn setTabStyle( TabStyle s ) | 146 | * @fn setTabStyle( TabStyle s ) |
147 | * @brief Set the current widget selection control style. | 147 | * @brief Set the current widget selection control style. |
148 | * | 148 | * |
149 | * @param s New style to be used. | 149 | * @param s New style to be used. |
150 | */ | 150 | */ |
151 | void setTabStyle( TabStyle ); | 151 | void setTabStyle( TabStyle ); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * @fn tabPosition() | 154 | * @fn tabPosition()const |
155 | * @brief Returns current widget selection control position. | 155 | * @brief Returns current widget selection control position. |
156 | */ | 156 | */ |
157 | TabPosition tabPosition() const; | 157 | TabPosition tabPosition() const; |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * @fn setTabPosition( TabPosition p ) | 160 | * @fn setTabPosition( TabPosition p ) |
161 | * @brief Set the current widget selection control position. | 161 | * @brief Set the current widget selection control position. |
162 | * | 162 | * |
163 | * @param p New position of widget selection control. | 163 | * @param p New position of widget selection control. |
164 | */ | 164 | */ |
165 | void setTabPosition( TabPosition ); | 165 | void setTabPosition( TabPosition ); |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * @fn setCurrentTab( QWidget *childwidget ) | 168 | * @fn setCurrentTab( QWidget *childwidget ) |
169 | * @brief Selects and brings to top the desired widget by using widget pointer. | 169 | * @brief Selects and brings to top the desired widget by using widget pointer. |
170 | * | 170 | * |
171 | * @param childwidget Widget to select. | 171 | * @param childwidget Widget to select. |
172 | */ | 172 | */ |
173 | void setCurrentTab( QWidget * ); | 173 | void setCurrentTab( QWidget * ); |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * @fn setCurrentTab( const QString &tabname ) | 176 | * @fn setCurrentTab( const QString &tabname ) |
177 | * @brief Selects and brings to top the desired widget, by using label. | 177 | * @brief Selects and brings to top the desired widget, by using label. |
178 | * | 178 | * |
179 | * @param tabname Text label for widget to select. | 179 | * @param tabname Text label for widget to select. |
180 | */ | 180 | */ |
181 | void setCurrentTab( const QString & ); | 181 | void setCurrentTab( const QString & ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * @fn setCurrentTab( int ) | 184 | * @fn setCurrentTab( int ) |
185 | * @brief Selects and brings to top the desired widget, by using id. | 185 | * @brief Selects and brings to top the desired widget, by using id. |
186 | * | 186 | * |
187 | * @param tab id for widget to select. | 187 | * @param tab id for widget to select. |
188 | */ | 188 | */ |
189 | void setCurrentTab(int); | 189 | void setCurrentTab(int); |
190 | 190 | ||
191 | /** | 191 | /** |
192 | * @fn sizeHint() | 192 | * @fn sizeHint()const |
193 | * @brief Reimplemented for internal purposes. | 193 | * @brief Reimplemented for internal purposes. |
194 | */ | 194 | */ |
195 | QSize sizeHint() const; | 195 | QSize sizeHint() const; |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * @fn currentTab( ) | 198 | * @fn currentTab( ) |
199 | * @brief returns current tab id. | 199 | * @brief returns current tab id. |
200 | */ | 200 | */ |
201 | int currentTab(); | 201 | int currentTab(); |
202 | 202 | ||
203 | 203 | ||
204 | protected: | 204 | protected: |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * @fn resizeEvent( QResizeEvent * ) | 207 | * @fn resizeEvent( QResizeEvent * ) |
208 | * @brief Reimplemented for internal purposes. | 208 | * @brief Reimplemented for internal purposes. |
209 | */ | 209 | */ |
210 | void resizeEvent( QResizeEvent * ); | 210 | void resizeEvent( QResizeEvent * ); |
211 | 211 | ||
212 | private: | 212 | private: |
213 | OTabInfoList tabs; | 213 | OTabInfoList tabs; |
214 | OTabInfo *currTab; | 214 | OTabInfo *currTab; |
215 | 215 | ||
216 | TabStyle tabBarStyle; | 216 | TabStyle tabBarStyle; |
217 | TabPosition tabBarPosition; | 217 | TabPosition tabBarPosition; |
218 | 218 | ||
219 | QWidgetStack *tabBarStack; | 219 | QWidgetStack *tabBarStack; |
220 | OTabBar *tabBar; | 220 | OTabBar *tabBar; |
221 | QComboBox *tabList; | 221 | QComboBox *tabList; |
222 | 222 | ||
223 | QWidgetStack *widgetStack; | 223 | QWidgetStack *widgetStack; |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * @fn loadSmooth( const QString &name ) | 226 | * @fn loadSmooth( const QString &name ) |
227 | * @brief Loads icon for widget. | 227 | * @brief Loads icon for widget. |
228 | * | 228 | * |
229 | * @param name Name of icon image file. | 229 | * @param name Name of icon image file. |
230 | */ | 230 | */ |
231 | QPixmap loadSmooth( const QString & ); | 231 | QPixmap loadSmooth( const QString & ); |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * @fn selectTab( OTabInfo *tab ) | 234 | * @fn selectTab( OTabInfo *tab ) |
235 | * @brief Internal function to select desired widget. | 235 | * @brief Internal function to select desired widget. |
236 | * | 236 | * |
237 | * @param tab Pointer to data for widget. | 237 | * @param tab Pointer to data for widget. |
238 | */ | 238 | */ |
239 | void selectTab( OTabInfo * ); | 239 | void selectTab( OTabInfo * ); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * @fn setUpLayout() | 242 | * @fn setUpLayout() |
243 | * @brief Internal function to adjust layout. | 243 | * @brief Internal function to adjust layout. |
244 | */ | 244 | */ |
245 | void setUpLayout(); | 245 | void setUpLayout(); |
246 | 246 | ||
247 | 247 | ||
248 | signals: | 248 | signals: |
249 | /** | 249 | /** |
250 | * @fn currentChanegd( QWidget *widget ) | 250 | * @fn currentChanegd( QWidget *widget ) |
251 | * @brief This signal is emitted whenever the widget has changed. | 251 | * @brief This signal is emitted whenever the widget has changed. |
252 | * | 252 | * |
253 | * @param widget Pointer to new current widget. | 253 | * @param widget Pointer to new current widget. |
254 | */ | 254 | */ |
255 | void currentChanged( QWidget * ); | 255 | void currentChanged( QWidget * ); |
256 | 256 | ||
257 | private slots: | 257 | private slots: |
258 | 258 | ||
259 | /** | 259 | /** |
260 | * @fn slotTabBarSelected( int id ) | 260 | * @fn slotTabBarSelected( int id ) |
261 | * @brief Slot which is called when a tab is selected. | 261 | * @brief Slot which is called when a tab is selected. |
262 | * | 262 | * |
263 | * @param id ID of widget selected. | 263 | * @param id ID of widget selected. |
264 | */ | 264 | */ |
265 | void slotTabBarSelected( int ); | 265 | void slotTabBarSelected( int ); |
266 | 266 | ||
267 | /** | 267 | /** |
268 | * @fn slotTabListSelected( int index ) | 268 | * @fn slotTabListSelected( int index ) |
269 | * @brief Slot which is called when a drop down selection is made. | 269 | * @brief Slot which is called when a drop down selection is made. |
270 | * | 270 | * |
271 | * @param id Index of widget selected. | 271 | * @param id Index of widget selected. |
272 | */ | 272 | */ |
273 | void slotTabListSelected( int ); | 273 | void slotTabListSelected( int ); |
274 | }; | 274 | }; |
275 | 275 | ||
276 | #endif | 276 | #endif |
diff --git a/libopie/oticker.h b/libopie/oticker.h index 30b7517..c848654 100644 --- a/libopie/oticker.h +++ b/libopie/oticker.h | |||
@@ -1,146 +1,147 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 3 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OTICKER_H | 31 | #ifndef OTICKER_H |
32 | #define OTICKER_H | 32 | #define OTICKER_H |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpainter.h> | 35 | #include <qpainter.h> |
36 | #include <qdrawutil.h> | 36 | #include <qdrawutil.h> |
37 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qslider.h> | 39 | #include <qslider.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qframe.h> | 41 | #include <qframe.h> |
42 | #include <qcolor.h> | 42 | #include <qcolor.h> |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @class OTicker | 45 | * @class OTicker |
46 | * @brief The OTicker class provides a QLabel widget that scroll its contents | 46 | * @brief The OTicker class provides a QLabel widget that scroll its contents |
47 | * | 47 | * |
48 | */ | 48 | */ |
49 | class OTicker : public QLabel { | 49 | class OTicker : public QLabel { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | 53 | ||
54 | /*! | 54 | /*! |
55 | * @fn OTicker( QWidget* parent = 0 ) | 55 | * @fn OTicker( QWidget* parent = 0 ) |
56 | * @brief Object constructor. | 56 | * @brief Object constructor. |
57 | * | 57 | * |
58 | * @param parent Pointer to parent of this control. | 58 | * @param parent Pointer to parent of this control. |
59 | 59 | ||
60 | * Constructs a new OTicker control with parent | 60 | * Constructs a new OTicker control with parent |
61 | */ | 61 | */ |
62 | OTicker( QWidget* parent=0 ); | 62 | OTicker( QWidget* parent=0 ); |
63 | /*! | 63 | /*! |
64 | * @fn ~OTicker() | 64 | * @fn ~OTicker() |
65 | * @brief Object destructor. | 65 | * @brief Object destructor. |
66 | */ | 66 | */ |
67 | ~OTicker(); | 67 | ~OTicker(); |
68 | /*! | 68 | /*! |
69 | * @fn setText() | 69 | * @fn setText(const QString& ) |
70 | * @brief sets text to be displayed | 70 | * @brief sets text to be displayed |
71 | * @param text QString text to be displayed. | 71 | * @param text QString text to be displayed. |
72 | * | 72 | * |
73 | */ | 73 | */ |
74 | void setText( const QString& text ) ; | 74 | void setText( const QString& text ) ; |
75 | /*! | 75 | /*! |
76 | * @fn setBackgroundColor(QColor color) | 76 | * @fn setBackgroundColor(QColor color) |
77 | * @brief sets color of the ticker's background | 77 | * @brief sets color of the ticker's background |
78 | * @param color QColor color to be set. | 78 | * @param color QColor color to be set. |
79 | * | 79 | * |
80 | */ | 80 | */ |
81 | //FIXME const QColor& please -zecke | ||
81 | void setBackgroundColor(QColor color); | 82 | void setBackgroundColor(QColor color); |
82 | /*! | 83 | /*! |
83 | * @fn setForegroundColor(QColor color) | 84 | * @fn setForegroundColor(QColor color) |
84 | * @brief sets color of text | 85 | * @brief sets color of text |
85 | * @param color QColor color of text | 86 | * @param color QColor color of text |
86 | * | 87 | * |
87 | */ | 88 | */ |
88 | void setForegroundColor(QColor color); | 89 | void setForegroundColor(QColor color); |
89 | /*! | 90 | /*! |
90 | * @fn setFrame(int style) | 91 | * @fn setFrame(int style) |
91 | * @brief sets frame style | 92 | * @brief sets frame style |
92 | * @param style int Frame style to be see. See Qt::WidgetFlags. | 93 | * @param style int Frame style to be see. See Qt::WidgetFlags. |
93 | * | 94 | * |
94 | */ | 95 | */ |
95 | void setFrame(int style); | 96 | void setFrame(int style); |
96 | /*! | 97 | /*! |
97 | * @fn setUpdateTime(int timeout) | 98 | * @fn setUpdateTime(int timeout) |
98 | * @brief sets time of update | 99 | * @brief sets time of update |
99 | * @param timeout int time in milliseconds between updates. | 100 | * @param timeout int time in milliseconds between updates. |
100 | * | 101 | * |
101 | */ | 102 | */ |
102 | void setUpdateTime(int timeout); | 103 | void setUpdateTime(int timeout); |
103 | /*! | 104 | /*! |
104 | * @fn setScrollLength(int length) | 105 | * @fn setScrollLength(int length) |
105 | * @brief sets amount of scrolling default is 1 | 106 | * @brief sets amount of scrolling default is 1 |
106 | * @param length int scroll length. | 107 | * @param length int scroll length. |
107 | * | 108 | * |
108 | */ | 109 | */ |
109 | void setScrollLength(int length); | 110 | void setScrollLength(int length); |
110 | signals: | 111 | signals: |
111 | /*! | 112 | /*! |
112 | * @fn mousePressed() | 113 | * @fn mousePressed() |
113 | * @brief signal mouse press event | 114 | * @brief signal mouse press event |
114 | * | 115 | * |
115 | */ | 116 | */ |
116 | void mousePressed(); | 117 | void mousePressed(); |
117 | protected: | 118 | protected: |
118 | /*! | 119 | /*! |
119 | * @fn timerEvent( QTimerEvent * e) | 120 | * @fn timerEvent( QTimerEvent * e) |
120 | * @brief timer timeout event | 121 | * @brief timer timeout event |
121 | * @param e QEvent see QEvent. | 122 | * @param e QEvent see QEvent. |
122 | * | 123 | * |
123 | */ | 124 | */ |
124 | void timerEvent( QTimerEvent * e); | 125 | void timerEvent( QTimerEvent * e); |
125 | /*! | 126 | /*! |
126 | * @fn drawContents( QPainter *p ) | 127 | * @fn drawContents( QPainter *p ) |
127 | * @brief draws widget contents | 128 | * @brief draws widget contents |
128 | * @param p QPainter. see QPainter | 129 | * @param p QPainter. see QPainter |
129 | * | 130 | * |
130 | */ | 131 | */ |
131 | void drawContents( QPainter *p ); | 132 | void drawContents( QPainter *p ); |
132 | /*! | 133 | /*! |
133 | * @fn mouseReleaseEvent( QMouseEvent *e) | 134 | * @fn mouseReleaseEvent( QMouseEvent *e) |
134 | * @brief mouse release event | 135 | * @brief mouse release event |
135 | * @param e QMouseEvent. see QMouseEvent. | 136 | * @param e QMouseEvent. see QMouseEvent. |
136 | * | 137 | * |
137 | */ | 138 | */ |
138 | void mouseReleaseEvent( QMouseEvent *e); | 139 | void mouseReleaseEvent( QMouseEvent *e); |
139 | private: | 140 | private: |
140 | QColor backgroundcolor, foregroundcolor; | 141 | QColor backgroundcolor, foregroundcolor; |
141 | QString scrollText; | 142 | QString scrollText; |
142 | QPixmap scrollTextPixmap; | 143 | QPixmap scrollTextPixmap; |
143 | int pos, updateTimerTime, scrollLength; | 144 | int pos, updateTimerTime, scrollLength; |
144 | }; | 145 | }; |
145 | 146 | ||
146 | #endif | 147 | #endif |
diff --git a/libopie/otimepicker.h b/libopie/otimepicker.h index 495c806..d501a95 100644 --- a/libopie/otimepicker.h +++ b/libopie/otimepicker.h | |||
@@ -1,81 +1,81 @@ | |||
1 | #ifndef OTIMEPICKER_H | 1 | #ifndef OTIMEPICKER_H |
2 | #define OTIMEPICKER_H | 2 | #define OTIMEPICKER_H |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qvaluelist.h> | 5 | #include <qvaluelist.h> |
6 | #include <qdatetime.h> | 6 | #include <qdatetime.h> |
7 | #include <qdialog.h> | 7 | #include <qdialog.h> |
8 | 8 | ||
9 | #include <opie/oclickablelabel.h> | 9 | #include <opie/oclickablelabel.h> |
10 | #include "otimepickerbase.h" | 10 | #include "otimepickerbase.h" |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * A class to pick time. It uses clickable labels | 13 | * A class to pick time. It uses clickable labels |
14 | * internally to allow a quick selection of a time. | 14 | * internally to allow a quick selection of a time. |
15 | * A time can be selected by two clicks of a user | 15 | * A time can be selected by two clicks of a user |
16 | * | 16 | * |
17 | * @short A widget to quickly pick a QTime | 17 | * @short A widget to quickly pick a QTime |
18 | * @version 1.0 | 18 | * @version 1.0 |
19 | * @see QWidget | 19 | * @see QWidget |
20 | * @see QTime | 20 | * @see QTime |
21 | * @author Hakan Ardo, Stefan Eilers | 21 | * @author Hakan Ardo, Stefan Eilers |
22 | */ | 22 | */ |
23 | class OTimePicker: public QWidget { | 23 | class OTimePicker: public QWidget { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | 25 | ||
26 | public: | 26 | public: |
27 | OTimePicker(QWidget* parent = 0, const char* name = 0, | 27 | OTimePicker(QWidget* parent = 0, const char* name = 0, |
28 | WFlags fl = 0); | 28 | WFlags fl = 0); |
29 | 29 | ||
30 | public slots: | 30 | public slots: |
31 | void setHour(int h); | 31 | void setHour(int h); |
32 | void setMinute(int m); | 32 | void setMinute(int m); |
33 | void setTime( const QTime& ); | 33 | void setTime( const QTime& ); |
34 | void setTime( int h, int m ); | 34 | void setTime( int h, int m ); |
35 | 35 | ||
36 | public: | 36 | public: |
37 | QTime time()const; | 37 | QTime time()const; |
38 | 38 | ||
39 | private: | 39 | private: |
40 | QValueList<OClickableLabel *> hourLst; | 40 | QValueList<OClickableLabel *> hourLst; |
41 | QValueList<OClickableLabel *> minuteLst; | 41 | QValueList<OClickableLabel *> minuteLst; |
42 | QTime tm; | 42 | QTime tm; |
43 | struct Private; | 43 | struct Private; |
44 | Private *d; | 44 | Private *d; |
45 | 45 | ||
46 | private slots: | 46 | private slots: |
47 | void slotHour(bool b); | 47 | void slotHour(bool b); |
48 | void slotMinute(bool b); | 48 | void slotMinute(bool b); |
49 | 49 | ||
50 | signals: | 50 | signals: |
51 | /** | 51 | /** |
52 | * gets emitted when the time got changed by the user | 52 | * gets emitted when the time got changed by the user |
53 | */ | 53 | */ |
54 | void timeChanged(const QTime &); | 54 | void timeChanged(const QTime &); |
55 | }; | 55 | }; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * | 58 | * |
59 | * @short | 59 | * @short A small dialog to pick a time |
60 | * @version 1.0 | 60 | * @version 1.0 |
61 | * @author Stefan Eilers | 61 | * @author Stefan Eilers |
62 | */ | 62 | */ |
63 | 63 | ||
64 | class OTimePickerDialog: public OTimePickerDialogBase { | 64 | class OTimePickerDialog: public OTimePickerDialogBase { |
65 | Q_OBJECT | 65 | Q_OBJECT |
66 | 66 | ||
67 | public: | 67 | public: |
68 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); | 68 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); |
69 | ~OTimePickerDialog() { }; | 69 | ~OTimePickerDialog() { }; |
70 | 70 | ||
71 | QTime time()const; | 71 | QTime time()const; |
72 | 72 | ||
73 | public slots: | 73 | public slots: |
74 | void setTime( const QTime& time ); | 74 | void setTime( const QTime& time ); |
75 | void setHour( const QString& hour ); | 75 | void setHour( const QString& hour ); |
76 | void setMinute( const QString& minute ); | 76 | void setMinute( const QString& minute ); |
77 | 77 | ||
78 | private: | 78 | private: |
79 | QTime m_time; | 79 | QTime m_time; |
80 | }; | 80 | }; |
81 | #endif | 81 | #endif |
diff --git a/libopie/todayconfigwidget.h b/libopie/todayconfigwidget.h index 6b49efc..f3501a1 100644 --- a/libopie/todayconfigwidget.h +++ b/libopie/todayconfigwidget.h | |||
@@ -1,39 +1,39 @@ | |||
1 | 1 | ||
2 | #ifndef CONFIG_WIDGET_H | 2 | #ifndef CONFIG_WIDGET_H |
3 | #define CONFIG_WIDGET_H | 3 | #define CONFIG_WIDGET_H |
4 | 4 | ||
5 | 5 | ||
6 | /** | 6 | /** |
7 | * A base class for all Today Config Widgets. | 7 | * A base class for all Today Config Widgets. |
8 | * This will let a Today plugin to add the possibility of configuration. | 8 | * This will let a Today plugin to add the possibility of configuration. |
9 | * Plugins need to inherit from this class and need to implement | 9 | * Plugins need to inherit from this class and need to implement |
10 | * the pure virtual method to control configuration. | 10 | * the pure virtual method to control configuration. |
11 | * The Plugin should read its configuration during creation of the Widget | 11 | * The Plugin should read its configuration during creation of the Widget |
12 | * | 12 | * |
13 | * | 13 | * |
14 | * @author Maximilian Reiß | 14 | * @author Maximilian Reiß |
15 | * @short base class of all today config widgets | 15 | * @short base class of all today config widgets |
16 | */ | 16 | */ |
17 | class TodayConfigWidget : public QWidget { | 17 | class TodayConfigWidget : public QWidget { |
18 | 18 | ||
19 | 19 | ||
20 | public: | 20 | public: |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * This will construct the widget. The widget gets deleted once the parent | 23 | * This will construct the widget. The widget gets deleted once the parent |
24 | * gets deleted as in any Qt application | 24 | * gets deleted as in any Qt application |
25 | * | 25 | * |
26 | * @param parent The parent of the widget | 26 | * @param parent The parent of the widget |
27 | * @paran name The name of the object | 27 | * @param name The name of the object |
28 | */ | 28 | */ |
29 | TodayConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; | 29 | TodayConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; |
30 | virtual ~TodayConfigWidget() {}; | 30 | virtual ~TodayConfigWidget() {}; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Plugins need to reimplement this in the config widget | 33 | * Plugins need to reimplement this in the config widget |
34 | * Used when the config dialog is closed to write config stuff | 34 | * Used when the config dialog is closed to write config stuff |
35 | */ | 35 | */ |
36 | virtual void writeConfig() = 0; | 36 | virtual void writeConfig() = 0; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | #endif | 39 | #endif |
diff --git a/libopie/todayplugininterface.h b/libopie/todayplugininterface.h index 29a12bc..532f492 100644 --- a/libopie/todayplugininterface.h +++ b/libopie/todayplugininterface.h | |||
@@ -1,106 +1,109 @@ | |||
1 | 1 | ||
2 | #ifndef TODAY_PLUGIN_INTERFACE | 2 | #ifndef TODAY_PLUGIN_INTERFACE |
3 | #define TODAY_PLUGIN_INTERFACE | 3 | #define TODAY_PLUGIN_INTERFACE |
4 | 4 | ||
5 | #include <qpe/qcom.h> | 5 | #include <qpe/qcom.h> |
6 | #include "todayconfigwidget.h" | 6 | #include "todayconfigwidget.h" |
7 | 7 | ||
8 | class QString; | 8 | class QString; |
9 | class QWidget; | 9 | class QWidget; |
10 | 10 | ||
11 | #ifndef IID_TodayPluginInterface | 11 | #ifndef IID_TodayPluginInterface |
12 | #define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) | 12 | #define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * | 16 | * |
17 | * A TodayPluginObject is the base for all Today Plugins. | 17 | * A TodayPluginObject is the base for all Today Plugins. |
18 | * A plugin author needs to inherit this class and implement | 18 | * A plugin author needs to inherit this class and implement |
19 | * the pure virtual methods | 19 | * the pure virtual methods |
20 | * | 20 | * |
21 | * @short base class for today plugins | 21 | * @short base class for today plugins |
22 | * @author Maximilian Reiss | 22 | * @author Maximilian Reiss |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | class TodayPluginObject { | 25 | class TodayPluginObject { |
26 | 26 | ||
27 | public: | 27 | public: |
28 | 28 | ||
29 | virtual ~TodayPluginObject() {}; | 29 | virtual ~TodayPluginObject() {}; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * The name if the plugin | 32 | * The name if the plugin |
33 | * @return The plugin should return its name here | 33 | * @return The plugin should return its name here |
34 | */ | 34 | */ |
35 | virtual QString pluginName() const = 0; | 35 | virtual QString pluginName() const = 0; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Version numbering | 38 | * Version numbering |
39 | * @return The plugin should return the version number | 39 | * @return The plugin should return the version number |
40 | */ | 40 | */ |
41 | virtual double versionNumber() const = 0; | 41 | virtual double versionNumber() const = 0; |
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @return the pixmap name widget?! -- FIXME | 45 | * @return the pixmap name widget?! -- FIXME |
46 | */ | 46 | */ |
47 | virtual QString pixmapNameWidget() const = 0; | 47 | virtual QString pixmapNameWidget() const = 0; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * widget for the today view | 50 | * widget for the today view |
51 | * It _needs_ a parent here. | 51 | * It _needs_ a parent here. |
52 | * Plugin authors need to take parent as parent! | 52 | * Plugin authors need to take parent as parent! |
53 | */ | 53 | */ |
54 | virtual QWidget* widget( QWidget *parent ) = 0; | 54 | virtual QWidget* widget( QWidget *parent ) = 0; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Pixmap used in the config widget | 57 | * Pixmap used in the config widget |
58 | */ | 58 | */ |
59 | virtual QString pixmapNameConfig() const = 0; | 59 | virtual QString pixmapNameConfig() const = 0; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Config plugin widget - optional | 62 | * Config plugin widget - optional |
63 | * If the plugin has a config widget, it _needs_ a parent here. | 63 | * If the plugin has a config widget, it _needs_ a parent here. |
64 | * may return 0 if no config widget is needed | 64 | * may return 0 if no config widget is needed |
65 | */ | 65 | */ |
66 | virtual TodayConfigWidget* configWidget( QWidget * ) = 0; | 66 | virtual TodayConfigWidget* configWidget( QWidget * ) = 0; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * The application that should be assigned to the button (pixmap) | 69 | * The application that should be assigned to the button (pixmap) |
70 | * Today will show the plugin icon. On click it tries to execute the | 70 | * Today will show the plugin icon. On click it tries to execute the |
71 | * plugin related application. | 71 | * plugin related application. |
72 | */ | 72 | */ |
73 | virtual QString appName() const = 0; | 73 | virtual QString appName() const = 0; |
74 | 74 | ||
75 | 75 | ||
76 | /** | 76 | /** |
77 | * If the plugin should take part in the periodic refresh | 77 | * If the plugin should take part in the periodic refresh |
78 | */ | 78 | */ |
79 | virtual bool excludeFromRefresh() const = 0; | 79 | virtual bool excludeFromRefresh() const = 0; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Refresh that plugins view. For updating the plugins | 82 | * Refresh that plugins view. For updating the plugins |
83 | * | 83 | * |
84 | */ | 84 | */ |
85 | virtual void refresh() {}; | 85 | virtual void refresh() {}; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * minimum height the plugin at least should have | 88 | * minimum height the plugin at least should have |
89 | */ | 89 | */ |
90 | // virtual int minHeight() const = 0; | 90 | // virtual int minHeight() const = 0; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * maximum height that should be used before starting scrolling | 93 | * maximum height that should be used before starting scrolling |
94 | */ | 94 | */ |
95 | // virtual int maxHeight() const = 0; | 95 | // virtual int maxHeight() const = 0; |
96 | 96 | ||
97 | }; | 97 | }; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * This is part of the QCOM works. See example plugins how to do it right | 100 | * This is part of the QCOM works. See example plugins how to do it right |
101 | */ | 101 | */ |
102 | struct TodayPluginInterface : public QUnknownInterface { | 102 | struct TodayPluginInterface : public QUnknownInterface { |
103 | /** | ||
104 | * return the TodayPluginObject implementation | ||
105 | */ | ||
103 | virtual TodayPluginObject *guiPart() = 0; | 106 | virtual TodayPluginObject *guiPart() = 0; |
104 | }; | 107 | }; |
105 | 108 | ||
106 | #endif | 109 | #endif |