author | ar <ar> | 2005-01-21 19:56:15 (UTC) |
---|---|---|
committer | ar <ar> | 2005-01-21 19:56:15 (UTC) |
commit | cd51d382be50bc021739395309e23760f1619759 (patch) (unidiff) | |
tree | e76155f772df7faea5fcf38667c6da8c916208db /libopie2 | |
parent | fdc37fbd908472e28735a8f0b01e3e66a43535e0 (diff) | |
download | opie-cd51d382be50bc021739395309e23760f1619759.zip opie-cd51d382be50bc021739395309e23760f1619759.tar.gz opie-cd51d382be50bc021739395309e23760f1619759.tar.bz2 |
- make opie compilable against qte 2.3.10 snapshot
check QT_VERSION against 0x030000 instead of 300
-rw-r--r-- | libopie2/opieui/oseparator.cpp | 2 | ||||
-rw-r--r-- | libopie2/qt3/opieui/oeditlistbox.h | 2 | ||||
-rw-r--r-- | libopie2/qt3/opieui/ojanuswidget.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opieui/oseparator.cpp b/libopie2/opieui/oseparator.cpp index bbc4381..177368b 100644 --- a/libopie2/opieui/oseparator.cpp +++ b/libopie2/opieui/oseparator.cpp | |||
@@ -15,115 +15,115 @@ | |||
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 | /* OPIE */ | 32 | /* OPIE */ |
33 | 33 | ||
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/oseparator.h> | 35 | #include <opie2/oseparator.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | 38 | ||
39 | using namespace Opie::Core; | 39 | using namespace Opie::Core; |
40 | using namespace Opie::Ui; | 40 | using namespace Opie::Ui; |
41 | 41 | ||
42 | OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f) | 42 | OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f) |
43 | : QFrame(parent, name, f) | 43 | : QFrame(parent, name, f) |
44 | { | 44 | { |
45 | setLineWidth(1); | 45 | setLineWidth(1); |
46 | setMidLineWidth(0); | 46 | setMidLineWidth(0); |
47 | setOrientation( HLine ); | 47 | setOrientation( HLine ); |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
52 | OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f) | 52 | OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f) |
53 | : QFrame(parent, name, f) | 53 | : QFrame(parent, name, f) |
54 | { | 54 | { |
55 | setLineWidth(1); | 55 | setLineWidth(1); |
56 | setMidLineWidth(0); | 56 | setMidLineWidth(0); |
57 | setOrientation( orientation ); | 57 | setOrientation( orientation ); |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | 61 | ||
62 | void OSeparator::setOrientation(int orientation) | 62 | void OSeparator::setOrientation(int orientation) |
63 | { | 63 | { |
64 | switch(orientation) | 64 | switch(orientation) |
65 | { | 65 | { |
66 | case Vertical: | 66 | case Vertical: |
67 | case VLine: | 67 | case VLine: |
68 | setFrameStyle( QFrame::VLine | QFrame::Sunken ); | 68 | setFrameStyle( QFrame::VLine | QFrame::Sunken ); |
69 | setMinimumSize(2, 0); | 69 | setMinimumSize(2, 0); |
70 | break; | 70 | break; |
71 | 71 | ||
72 | default: | 72 | default: |
73 | owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl; | 73 | owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl; |
74 | 74 | ||
75 | case Horizontal: | 75 | case Horizontal: |
76 | case HLine: | 76 | case HLine: |
77 | setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 77 | setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
78 | setMinimumSize(0, 2); | 78 | setMinimumSize(0, 2); |
79 | break; | 79 | break; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | 84 | ||
85 | int OSeparator::orientation() const | 85 | int OSeparator::orientation() const |
86 | { | 86 | { |
87 | if ( frameStyle() & VLine ) | 87 | if ( frameStyle() & VLine ) |
88 | return VLine; | 88 | return VLine; |
89 | 89 | ||
90 | if ( frameStyle() & HLine ) | 90 | if ( frameStyle() & HLine ) |
91 | return HLine; | 91 | return HLine; |
92 | 92 | ||
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
95 | 95 | ||
96 | void OSeparator::drawFrame(QPainter *p) | 96 | void OSeparator::drawFrame(QPainter *p) |
97 | { | 97 | { |
98 | QPointp1, p2; | 98 | QPointp1, p2; |
99 | QRectr = frameRect(); | 99 | QRectr = frameRect(); |
100 | const QColorGroup & g = colorGroup(); | 100 | const QColorGroup & g = colorGroup(); |
101 | 101 | ||
102 | if ( frameStyle() & HLine ) { | 102 | if ( frameStyle() & HLine ) { |
103 | p1 = QPoint( r.x(), r.height()/2 ); | 103 | p1 = QPoint( r.x(), r.height()/2 ); |
104 | p2 = QPoint( r.x()+r.width(), p1.y() ); | 104 | p2 = QPoint( r.x()+r.width(), p1.y() ); |
105 | } | 105 | } |
106 | else { | 106 | else { |
107 | p1 = QPoint( r.x()+r.width()/2, 0 ); | 107 | p1 = QPoint( r.x()+r.width()/2, 0 ); |
108 | p2 = QPoint( p1.x(), r.height() ); | 108 | p2 = QPoint( p1.x(), r.height() ); |
109 | } | 109 | } |
110 | 110 | ||
111 | #if QT_VERSION < 300 | 111 | #if QT_VERSION < 0x030000 |
112 | style().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, 1, midLineWidth() ); | 112 | style().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, 1, midLineWidth() ); |
113 | #else | 113 | #else |
114 | QStyleOption opt( lineWidth(), midLineWidth() ); | 114 | QStyleOption opt( lineWidth(), midLineWidth() ); |
115 | style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, QStyle::Style_Sunken, opt ); | 115 | style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, QStyle::Style_Sunken, opt ); |
116 | #endif | 116 | #endif |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | QSize OSeparator::sizeHint() const | 120 | QSize OSeparator::sizeHint() const |
121 | { | 121 | { |
122 | if ( frameStyle() & VLine ) | 122 | if ( frameStyle() & VLine ) |
123 | return QSize(2, 0); | 123 | return QSize(2, 0); |
124 | 124 | ||
125 | if ( frameStyle() & HLine ) | 125 | if ( frameStyle() & HLine ) |
126 | return QSize(0, 2); | 126 | return QSize(0, 2); |
127 | 127 | ||
128 | return QSize(-1, -1); | 128 | return QSize(-1, -1); |
129 | } | 129 | } |
diff --git a/libopie2/qt3/opieui/oeditlistbox.h b/libopie2/qt3/opieui/oeditlistbox.h index 63fab11..c9c207d 100644 --- a/libopie2/qt3/opieui/oeditlistbox.h +++ b/libopie2/qt3/opieui/oeditlistbox.h | |||
@@ -1,126 +1,126 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org> | 2 | Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org> |
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 | #ifndef OEDITLISTBOX_H | 20 | #ifndef OEDITLISTBOX_H |
21 | #define OEDITLISTBOX_H | 21 | #define OEDITLISTBOX_H |
22 | 22 | ||
23 | #include <qgroupbox.h> | 23 | #include <qgroupbox.h> |
24 | #include <qlistbox.h> | 24 | #include <qlistbox.h> |
25 | 25 | ||
26 | class OLineEdit; | 26 | class OLineEdit; |
27 | class OComboBox; | 27 | class OComboBox; |
28 | class QPushButton; | 28 | class QPushButton; |
29 | 29 | ||
30 | #if QT_VERSION < 300 | 30 | #if QT_VERSION < 0x030000 |
31 | enum StringComparisonMode { | 31 | enum StringComparisonMode { |
32 | CaseSensitive = 0x00001, // 0 0001 | 32 | CaseSensitive = 0x00001, // 0 0001 |
33 | BeginsWith = 0x00002, // 0 0010 | 33 | BeginsWith = 0x00002, // 0 0010 |
34 | EndsWith = 0x00004, // 0 0100 | 34 | EndsWith = 0x00004, // 0 0100 |
35 | Contains = 0x00008, // 0 1000 | 35 | Contains = 0x00008, // 0 1000 |
36 | ExactMatch = 0x00010 // 1 0000 | 36 | ExactMatch = 0x00010 // 1 0000 |
37 | }; | 37 | }; |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | class OEditListBoxPrivate; | 40 | class OEditListBoxPrivate; |
41 | /** | 41 | /** |
42 | * An editable listbox | 42 | * An editable listbox |
43 | * | 43 | * |
44 | * This class provides a editable listbox ;-), this means | 44 | * This class provides a editable listbox ;-), this means |
45 | * a listbox which is accompanied by a line edit to enter new | 45 | * a listbox which is accompanied by a line edit to enter new |
46 | * items into the listbox and pushbuttons to add and remove | 46 | * items into the listbox and pushbuttons to add and remove |
47 | * items from the listbox and two buttons to move items up and down. | 47 | * items from the listbox and two buttons to move items up and down. |
48 | */ | 48 | */ |
49 | class OEditListBox : public QGroupBox | 49 | class OEditListBox : public QGroupBox |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | 52 | ||
53 | public: | 53 | public: |
54 | /// @since 3.1 | 54 | /// @since 3.1 |
55 | class CustomEditor | 55 | class CustomEditor |
56 | { | 56 | { |
57 | public: | 57 | public: |
58 | CustomEditor() | 58 | CustomEditor() |
59 | : m_representationWidget( 0L ), | 59 | : m_representationWidget( 0L ), |
60 | m_lineEdit( 0L ) {} | 60 | m_lineEdit( 0L ) {} |
61 | CustomEditor( QWidget *repWidget, OLineEdit *edit ) | 61 | CustomEditor( QWidget *repWidget, OLineEdit *edit ) |
62 | : m_representationWidget( repWidget ), | 62 | : m_representationWidget( repWidget ), |
63 | m_lineEdit( edit ) {} | 63 | m_lineEdit( edit ) {} |
64 | CustomEditor( OComboBox *combo ); | 64 | CustomEditor( OComboBox *combo ); |
65 | 65 | ||
66 | void setRepresentationWidget( QWidget *repWidget ) { | 66 | void setRepresentationWidget( QWidget *repWidget ) { |
67 | m_representationWidget = repWidget; | 67 | m_representationWidget = repWidget; |
68 | } | 68 | } |
69 | void setLineEdit( OLineEdit *edit ) { | 69 | void setLineEdit( OLineEdit *edit ) { |
70 | m_lineEdit = edit; | 70 | m_lineEdit = edit; |
71 | } | 71 | } |
72 | 72 | ||
73 | virtual QWidget *representationWidget() const { | 73 | virtual QWidget *representationWidget() const { |
74 | return m_representationWidget; | 74 | return m_representationWidget; |
75 | } | 75 | } |
76 | virtual OLineEdit *lineEdit() const { | 76 | virtual OLineEdit *lineEdit() const { |
77 | return m_lineEdit; | 77 | return m_lineEdit; |
78 | } | 78 | } |
79 | 79 | ||
80 | protected: | 80 | protected: |
81 | QWidget *m_representationWidget; | 81 | QWidget *m_representationWidget; |
82 | OLineEdit *m_lineEdit; | 82 | OLineEdit *m_lineEdit; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | public: | 85 | public: |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * Enumeration of the buttons, the listbox offers. Specify them in the | 88 | * Enumeration of the buttons, the listbox offers. Specify them in the |
89 | * constructor in the buttons parameter. | 89 | * constructor in the buttons parameter. |
90 | */ | 90 | */ |
91 | enum Button { Add = 1, Remove = 2, UpDown = 4, All = Add|Remove|UpDown }; | 91 | enum Button { Add = 1, Remove = 2, UpDown = 4, All = Add|Remove|UpDown }; |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Create an editable listbox. | 94 | * Create an editable listbox. |
95 | * | 95 | * |
96 | * If @p checkAtEntering is true, after every character you type | 96 | * If @p checkAtEntering is true, after every character you type |
97 | * in the line edit OEditListBox will enable or disable | 97 | * in the line edit OEditListBox will enable or disable |
98 | * the Add-button, depending whether the current content of the | 98 | * the Add-button, depending whether the current content of the |
99 | * line edit is already in the listbox. Maybe this can become a | 99 | * line edit is already in the listbox. Maybe this can become a |
100 | * performance hit with large lists on slow machines. | 100 | * performance hit with large lists on slow machines. |
101 | * If @p checkAtEntering is false, | 101 | * If @p checkAtEntering is false, |
102 | * it will be checked if you press the Add-button. It is not | 102 | * it will be checked if you press the Add-button. It is not |
103 | * possible to enter items twice into the listbox. | 103 | * possible to enter items twice into the listbox. |
104 | */ | 104 | */ |
105 | OEditListBox(QWidget *parent = 0, const char *name = 0, | 105 | OEditListBox(QWidget *parent = 0, const char *name = 0, |
106 | bool checkAtEntering=false, int buttons = All ); | 106 | bool checkAtEntering=false, int buttons = All ); |
107 | /** | 107 | /** |
108 | * Create an editable listbox. | 108 | * Create an editable listbox. |
109 | * | 109 | * |
110 | * The same as the other constructor, additionally it takes | 110 | * The same as the other constructor, additionally it takes |
111 | * @title, which will be the title of the frame around the listbox. | 111 | * @title, which will be the title of the frame around the listbox. |
112 | */ | 112 | */ |
113 | OEditListBox(const QString& title, QWidget *parent = 0, | 113 | OEditListBox(const QString& title, QWidget *parent = 0, |
114 | const char *name = 0, bool checkAtEntering=false, | 114 | const char *name = 0, bool checkAtEntering=false, |
115 | int buttons = All ); | 115 | int buttons = All ); |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Another constructor, which allows to use a custom editing widget | 118 | * Another constructor, which allows to use a custom editing widget |
119 | * instead of the standard OLineEdit widget. E.g. you can use a | 119 | * instead of the standard OLineEdit widget. E.g. you can use a |
120 | * @ref OURLRequester or a @ref OComboBox as input widget. The custom | 120 | * @ref OURLRequester or a @ref OComboBox as input widget. The custom |
121 | * editor must consist of a lineedit and optionally another widget that | 121 | * editor must consist of a lineedit and optionally another widget that |
122 | * is used as representation. A OComboBox or a OURLRequester have a | 122 | * is used as representation. A OComboBox or a OURLRequester have a |
123 | * OLineEdit as child-widget for example, so the OComboBox is used as | 123 | * OLineEdit as child-widget for example, so the OComboBox is used as |
124 | * the representation widget. | 124 | * the representation widget. |
125 | * | 125 | * |
126 | * @see OURLRequester::customEditor() | 126 | * @see OURLRequester::customEditor() |
diff --git a/libopie2/qt3/opieui/ojanuswidget.cpp b/libopie2/qt3/opieui/ojanuswidget.cpp index 063e393..8bdbc03 100644 --- a/libopie2/qt3/opieui/ojanuswidget.cpp +++ b/libopie2/qt3/opieui/ojanuswidget.cpp | |||
@@ -679,193 +679,193 @@ int OJanusWidget::pageIndex( QWidget *widget ) const | |||
679 | { | 679 | { |
680 | return( -1 ); | 680 | return( -1 ); |
681 | } | 681 | } |
682 | else if( mFace == TreeList || mFace == IconList ) | 682 | else if( mFace == TreeList || mFace == IconList ) |
683 | { | 683 | { |
684 | return( mPageList->findRef( widget ) ); | 684 | return( mPageList->findRef( widget ) ); |
685 | } | 685 | } |
686 | else if( mFace == Tabbed ) | 686 | else if( mFace == Tabbed ) |
687 | { | 687 | { |
688 | // | 688 | // |
689 | // The user gets the real page widget with addVBoxPage(), addHBoxPage() | 689 | // The user gets the real page widget with addVBoxPage(), addHBoxPage() |
690 | // and addGridPage() but not with addPage() which returns a child of | 690 | // and addGridPage() but not with addPage() which returns a child of |
691 | // the toplevel page. addPage() returns a QFrame so I check for that. | 691 | // the toplevel page. addPage() returns a QFrame so I check for that. |
692 | // | 692 | // |
693 | if( widget->isA("QFrame") ) | 693 | if( widget->isA("QFrame") ) |
694 | { | 694 | { |
695 | return( mPageList->findRef( widget->parentWidget() ) ); | 695 | return( mPageList->findRef( widget->parentWidget() ) ); |
696 | } | 696 | } |
697 | else | 697 | else |
698 | { | 698 | { |
699 | return( mPageList->findRef( widget ) ); | 699 | return( mPageList->findRef( widget ) ); |
700 | } | 700 | } |
701 | } | 701 | } |
702 | else | 702 | else |
703 | { | 703 | { |
704 | return( -1 ); | 704 | return( -1 ); |
705 | } | 705 | } |
706 | } | 706 | } |
707 | 707 | ||
708 | void OJanusWidget::slotFontChanged() | 708 | void OJanusWidget::slotFontChanged() |
709 | { | 709 | { |
710 | #ifdef FIXME | 710 | #ifdef FIXME |
711 | 711 | ||
712 | if ( mTitleLabel != 0 ) | 712 | if ( mTitleLabel != 0 ) |
713 | { | 713 | { |
714 | mTitleLabel->setFont( KGlobalSettings::generalFont() ); | 714 | mTitleLabel->setFont( KGlobalSettings::generalFont() ); |
715 | QFont titleFont( mTitleLabel->font() ); | 715 | QFont titleFont( mTitleLabel->font() ); |
716 | titleFont.setBold( true ); | 716 | titleFont.setBold( true ); |
717 | mTitleLabel->setFont( titleFont ); | 717 | mTitleLabel->setFont( titleFont ); |
718 | } | 718 | } |
719 | #endif | 719 | #endif |
720 | 720 | ||
721 | if( mFace == IconList ) | 721 | if( mFace == IconList ) |
722 | { | 722 | { |
723 | QFont listFont( mIconList->font() ); | 723 | QFont listFont( mIconList->font() ); |
724 | listFont.setBold( true ); | 724 | listFont.setBold( true ); |
725 | mIconList->setFont( listFont ); | 725 | mIconList->setFont( listFont ); |
726 | mIconList->invalidateHeight(); | 726 | mIconList->invalidateHeight(); |
727 | mIconList->invalidateWidth(); | 727 | mIconList->invalidateWidth(); |
728 | } | 728 | } |
729 | } | 729 | } |
730 | 730 | ||
731 | // makes the treelist behave like the list of kcontrol | 731 | // makes the treelist behave like the list of kcontrol |
732 | void OJanusWidget::slotItemClicked(QListViewItem *it) | 732 | void OJanusWidget::slotItemClicked(QListViewItem *it) |
733 | { | 733 | { |
734 | if(it && (it->childCount()>0)) | 734 | if(it && (it->childCount()>0)) |
735 | it->setOpen(!it->isOpen()); | 735 | it->setOpen(!it->isOpen()); |
736 | } | 736 | } |
737 | 737 | ||
738 | void OJanusWidget::setFocus() | 738 | void OJanusWidget::setFocus() |
739 | { | 739 | { |
740 | if( mValid == false ) { return; } | 740 | if( mValid == false ) { return; } |
741 | if( mFace == TreeList ) | 741 | if( mFace == TreeList ) |
742 | { | 742 | { |
743 | mTreeList->setFocus(); | 743 | mTreeList->setFocus(); |
744 | } | 744 | } |
745 | if( mFace == IconList ) | 745 | if( mFace == IconList ) |
746 | { | 746 | { |
747 | mIconList->setFocus(); | 747 | mIconList->setFocus(); |
748 | } | 748 | } |
749 | else if( mFace == Tabbed ) | 749 | else if( mFace == Tabbed ) |
750 | { | 750 | { |
751 | mTabControl->setFocus(); | 751 | mTabControl->setFocus(); |
752 | } | 752 | } |
753 | else if( mFace == Swallow ) | 753 | else if( mFace == Swallow ) |
754 | { | 754 | { |
755 | mSwallowPage->setFocus(); | 755 | mSwallowPage->setFocus(); |
756 | } | 756 | } |
757 | else if( mFace == Plain ) | 757 | else if( mFace == Plain ) |
758 | { | 758 | { |
759 | mPlainPage->setFocus(); | 759 | mPlainPage->setFocus(); |
760 | } | 760 | } |
761 | } | 761 | } |
762 | 762 | ||
763 | 763 | ||
764 | QSize OJanusWidget::minimumSizeHint() const | 764 | QSize OJanusWidget::minimumSizeHint() const |
765 | { | 765 | { |
766 | if( mFace == TreeList || mFace == IconList ) | 766 | if( mFace == TreeList || mFace == IconList ) |
767 | { | 767 | { |
768 | QSize s1( ODialog::spacingHint(), ODialog::spacingHint()*2 ); | 768 | QSize s1( ODialog::spacingHint(), ODialog::spacingHint()*2 ); |
769 | QSize s2(0,0); | 769 | QSize s2(0,0); |
770 | QSize s3(0,0); | 770 | QSize s3(0,0); |
771 | QSize s4( mPageStack->sizeHint() ); | 771 | QSize s4( mPageStack->sizeHint() ); |
772 | 772 | ||
773 | if( mFace == TreeList ) | 773 | if( mFace == TreeList ) |
774 | { | 774 | { |
775 | #if QT_VERSION < 300 | 775 | #if QT_VERSION < 0x030000 |
776 | s1.rwidth() += style().splitterWidth(); | 776 | s1.rwidth() += style().splitterWidth(); |
777 | #else | 777 | #else |
778 | s1.rwidth() += style().pixelMetric( QStyle::PM_SplitterWidth ); | 778 | s1.rwidth() += style().pixelMetric( QStyle::PM_SplitterWidth ); |
779 | #endif | 779 | #endif |
780 | s2 = mTreeList->minimumSize(); | 780 | s2 = mTreeList->minimumSize(); |
781 | } | 781 | } |
782 | else | 782 | else |
783 | { | 783 | { |
784 | mIconList->updateMinimumHeight(); | 784 | mIconList->updateMinimumHeight(); |
785 | mIconList->updateWidth(); | 785 | mIconList->updateWidth(); |
786 | s2 = mIconList->minimumSize(); | 786 | s2 = mIconList->minimumSize(); |
787 | } | 787 | } |
788 | 788 | ||
789 | if( mTitleLabel->isVisible() == true ) | 789 | if( mTitleLabel->isVisible() == true ) |
790 | { | 790 | { |
791 | s3 += mTitleLabel->sizeHint(); | 791 | s3 += mTitleLabel->sizeHint(); |
792 | s3.rheight() += mTitleSep->minimumSize().height(); | 792 | s3.rheight() += mTitleSep->minimumSize().height(); |
793 | } | 793 | } |
794 | 794 | ||
795 | // | 795 | // |
796 | // Select the tallest item. It has only effect in IconList mode | 796 | // Select the tallest item. It has only effect in IconList mode |
797 | // | 797 | // |
798 | int h1 = s1.rheight() + s3.rheight() + s4.height(); | 798 | int h1 = s1.rheight() + s3.rheight() + s4.height(); |
799 | int h2 = QMAX( h1, s2.rheight() ); | 799 | int h2 = QMAX( h1, s2.rheight() ); |
800 | 800 | ||
801 | return( QSize( s1.width()+s2.width()+QMAX(s3.width(),s4.width()), h2 ) ); | 801 | return( QSize( s1.width()+s2.width()+QMAX(s3.width(),s4.width()), h2 ) ); |
802 | } | 802 | } |
803 | else if( mFace == Tabbed ) | 803 | else if( mFace == Tabbed ) |
804 | { | 804 | { |
805 | return( mTabControl->sizeHint() ); | 805 | return( mTabControl->sizeHint() ); |
806 | } | 806 | } |
807 | else if( mFace == Swallow ) | 807 | else if( mFace == Swallow ) |
808 | { | 808 | { |
809 | return( mSwallowPage->minimumSize() ); | 809 | return( mSwallowPage->minimumSize() ); |
810 | } | 810 | } |
811 | else if( mFace == Plain ) | 811 | else if( mFace == Plain ) |
812 | { | 812 | { |
813 | return( mPlainPage->sizeHint() ); | 813 | return( mPlainPage->sizeHint() ); |
814 | } | 814 | } |
815 | else | 815 | else |
816 | { | 816 | { |
817 | return( QSize( 100, 100 ) ); // Should never happen though. | 817 | return( QSize( 100, 100 ) ); // Should never happen though. |
818 | } | 818 | } |
819 | 819 | ||
820 | } | 820 | } |
821 | 821 | ||
822 | 822 | ||
823 | QSize OJanusWidget::sizeHint() const | 823 | QSize OJanusWidget::sizeHint() const |
824 | { | 824 | { |
825 | return( minimumSizeHint() ); | 825 | return( minimumSizeHint() ); |
826 | } | 826 | } |
827 | 827 | ||
828 | 828 | ||
829 | void OJanusWidget::setTreeListAutoResize( bool state ) | 829 | void OJanusWidget::setTreeListAutoResize( bool state ) |
830 | { | 830 | { |
831 | if( mFace == TreeList ) | 831 | if( mFace == TreeList ) |
832 | { | 832 | { |
833 | mTreeListResizeMode = state == false ? | 833 | mTreeListResizeMode = state == false ? |
834 | QSplitter::KeepSize : QSplitter::Stretch; | 834 | QSplitter::KeepSize : QSplitter::Stretch; |
835 | QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); | 835 | QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); |
836 | splitter->setResizeMode( mTreeList, mTreeListResizeMode ); | 836 | splitter->setResizeMode( mTreeList, mTreeListResizeMode ); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | 839 | ||
840 | 840 | ||
841 | void OJanusWidget::setIconListAllVisible( bool state ) | 841 | void OJanusWidget::setIconListAllVisible( bool state ) |
842 | { | 842 | { |
843 | if( mFace == IconList ) | 843 | if( mFace == IconList ) |
844 | { | 844 | { |
845 | mIconList->setShowAll( state ); | 845 | mIconList->setShowAll( state ); |
846 | } | 846 | } |
847 | } | 847 | } |
848 | 848 | ||
849 | void OJanusWidget::setShowIconsInTreeList( bool state ) | 849 | void OJanusWidget::setShowIconsInTreeList( bool state ) |
850 | { | 850 | { |
851 | mShowIconsInTreeList = state; | 851 | mShowIconsInTreeList = state; |
852 | } | 852 | } |
853 | 853 | ||
854 | void OJanusWidget::setRootIsDecorated( bool state ) | 854 | void OJanusWidget::setRootIsDecorated( bool state ) |
855 | { | 855 | { |
856 | if( mFace == TreeList ) { | 856 | if( mFace == TreeList ) { |
857 | mTreeList->setRootIsDecorated(state); | 857 | mTreeList->setRootIsDecorated(state); |
858 | } | 858 | } |
859 | } | 859 | } |
860 | 860 | ||
861 | void OJanusWidget::unfoldTreeList( bool persist ) | 861 | void OJanusWidget::unfoldTreeList( bool persist ) |
862 | { | 862 | { |
863 | if( mFace == TreeList ) | 863 | if( mFace == TreeList ) |
864 | { | 864 | { |
865 | if( persist ) | 865 | if( persist ) |
866 | connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); | 866 | connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); |
867 | else | 867 | else |
868 | disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); | 868 | disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); |
869 | 869 | ||
870 | for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) | 870 | for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) |
871 | item->setOpen( true ); | 871 | item->setOpen( true ); |