author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/jumpbuttonbar.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/jumpbuttonbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/jumpbuttonbar.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kaddressbook/jumpbuttonbar.cpp b/kaddressbook/jumpbuttonbar.cpp index aebf8a6..740b7db 100644 --- a/kaddressbook/jumpbuttonbar.cpp +++ b/kaddressbook/jumpbuttonbar.cpp | |||
@@ -12,34 +12,37 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qevent.h> | 24 | #include <qevent.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qtl.h> | 28 | #include <q3tl.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #include <QDesktopWidget> | ||
31 | //Added by qt3to4: | ||
32 | #include <Q3GridLayout> | ||
30 | 33 | ||
31 | #include <kabc/addressbook.h> | 34 | #include <kabc/addressbook.h> |
32 | #include <kabc/field.h> | 35 | #include <kabc/field.h> |
33 | #include <kdebug.h> | 36 | #include <kdebug.h> |
34 | #include <klocale.h> | 37 | #include <klocale.h> |
35 | 38 | ||
36 | #include "kabcore.h" | 39 | #include "kabcore.h" |
37 | 40 | ||
38 | #include "jumpbuttonbar.h" | 41 | #include "jumpbuttonbar.h" |
39 | 42 | ||
40 | class JumpButton : public QPushButton | 43 | class JumpButton : public QPushButton |
41 | { | 44 | { |
42 | public: | 45 | public: |
43 | JumpButton( const QString &text, QWidget *parent, | 46 | JumpButton( const QString &text, QWidget *parent, |
44 | const QString &character ); | 47 | const QString &character ); |
45 | 48 | ||
@@ -60,35 +63,35 @@ JumpButton::JumpButton( const QString &text, QWidget *parent, | |||
60 | void JumpButton::setCharacter( const QString &character ) | 63 | void JumpButton::setCharacter( const QString &character ) |
61 | { | 64 | { |
62 | mCharacter = character; | 65 | mCharacter = character; |
63 | setText(mCharacter.upper() ); | 66 | setText(mCharacter.upper() ); |
64 | } | 67 | } |
65 | 68 | ||
66 | QString JumpButton::character() const | 69 | QString JumpButton::character() const |
67 | { | 70 | { |
68 | return mCharacter; | 71 | return mCharacter; |
69 | } | 72 | } |
70 | 73 | ||
71 | JumpButtonBar::JumpButtonBar( KABCore *core, QWidget *parent, const char *name ) | 74 | JumpButtonBar::JumpButtonBar( KABCore *core, QWidget *parent, const char *name ) |
72 | : QWidget( parent, name ), mCore( core ) | 75 | : QWidget( parent, name ), mCore( core ) |
73 | { | 76 | { |
74 | if ( QApplication::desktop()->width() < 480 ) | 77 | if ( QApplication::desktop()->width() < 480 ) |
75 | 78 | ||
76 | mButtonLayout = new QGridLayout( this, 1, 18 ); | 79 | mButtonLayout = new Q3GridLayout( this, 1, 18 ); |
77 | else | 80 | else |
78 | mButtonLayout = new QGridLayout( this, 1, 20 ); | 81 | mButtonLayout = new Q3GridLayout( this, 1, 20 ); |
79 | mButtonLayout->setAlignment( Qt::AlignTop ); | 82 | mButtonLayout->setAlignment( Qt::AlignTop ); |
80 | 83 | ||
81 | recreateButtons(); | 84 | recreateButtons(); |
82 | } | 85 | } |
83 | 86 | ||
84 | JumpButtonBar::~JumpButtonBar() | 87 | JumpButtonBar::~JumpButtonBar() |
85 | { | 88 | { |
86 | } | 89 | } |
87 | 90 | ||
88 | QSizePolicy JumpButtonBar::sizePolicy() const | 91 | QSizePolicy JumpButtonBar::sizePolicy() const |
89 | { | 92 | { |
90 | #ifndef KAB_EMBEDDED | 93 | #ifndef KAB_EMBEDDED |
91 | return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum, | 94 | return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum, |
92 | QSizePolicy::Vertically ); | 95 | QSizePolicy::Vertically ); |
93 | #else //KAB_EMBEDDED | 96 | #else //KAB_EMBEDDED |
94 | return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum); | 97 | return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum); |
@@ -239,19 +242,19 @@ void JumpButtonBar::sortListLocaleAware( QStringList &list ) | |||
239 | while ( j1 != walkBackIt ) { | 242 | while ( j1 != walkBackIt ) { |
240 | #ifndef KAB_EMBEDDED | 243 | #ifndef KAB_EMBEDDED |
241 | if ( QString::localeAwareCompare( *j2, *j1 ) < 0 ) | 244 | if ( QString::localeAwareCompare( *j2, *j1 ) < 0 ) |
242 | #else //KAB_EMBEDDED | 245 | #else //KAB_EMBEDDED |
243 | if ( QString::compare( *j2, *j1 ) < 0 ) | 246 | if ( QString::compare( *j2, *j1 ) < 0 ) |
244 | #endif //KAB_EMBEDDED | 247 | #endif //KAB_EMBEDDED |
245 | qSwap( *j1, *j2 ); | 248 | qSwap( *j1, *j2 ); |
246 | 249 | ||
247 | ++j1; | 250 | ++j1; |
248 | ++j2; | 251 | ++j2; |
249 | } | 252 | } |
250 | ++beginIt; | 253 | ++beginIt; |
251 | --walkBackIt; | 254 | --walkBackIt; |
252 | } | 255 | } |
253 | } | 256 | } |
254 | 257 | ||
255 | #ifndef KAB_EMBEDDED | 258 | #ifndef KAB_EMBEDDED_ |
256 | #include "jumpbuttonbar.moc" | 259 | #include "moc_jumpbuttonbar.cpp" |
257 | #endif //KAB_EMBEDDED | 260 | #endif //KAB_EMBEDDED |