summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp5
-rw-r--r--libopie2/opieui/ofontselector.cpp3
2 files changed, 7 insertions, 1 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp
index ebce0ef..4c6b800 100644
--- a/libopie2/opieui/fileselector/ofiledialog.cpp
+++ b/libopie2/opieui/fileselector/ofiledialog.cpp
@@ -1,105 +1,108 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (C) Holger Freyther <zecke@handhelds.org> 3             .=l. Copyright (C) Holger Freyther <zecke@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 29
30/* OPIE */ 30/* OPIE */
31#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
32#include <qpe/applnk.h> 32#include <qpe/applnk.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35 35
36/* QT */ 36/* QT */
37#include <qfileinfo.h> 37#include <qfileinfo.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <qapplication.h> 39#include <qapplication.h>
40#include <qlayout.h> 40#include <qlayout.h>
41 41
42
43/* TRANSLATOR Opie::Ui::OFileDialog */
44
42using namespace Opie::Ui; 45using namespace Opie::Ui;
43 46
44namespace 47namespace
45{ 48{
46/* 49/*
47 * helper functions to load the start dir 50 * helper functions to load the start dir
48 * and to save it 51 * and to save it
49 * helper to extract the dir out of a file name 52 * helper to extract the dir out of a file name
50 */ 53 */
51/** 54/**
52 * This method will use Config( argv[0] ); 55 * This method will use Config( argv[0] );
53 * @param key The group key used 56 * @param key The group key used
54 */ 57 */
55QString lastUsedDir( const QString& key ) 58QString lastUsedDir( const QString& key )
56{ 59{
57 if ( qApp->argc() < 1 ) 60 if ( qApp->argc() < 1 )
58 return QString::null; 61 return QString::null;
59 62
60 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname 63 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname
61 cfg.setGroup( key ); 64 cfg.setGroup( key );
62 return cfg.readEntry("LastDir", QPEApplication::documentDir() ); 65 return cfg.readEntry("LastDir", QPEApplication::documentDir() );
63} 66}
64 67
65void saveLastDir( const QString& key, const QString& file ) 68void saveLastDir( const QString& key, const QString& file )
66{ 69{
67 if ( qApp->argc() < 1 ) 70 if ( qApp->argc() < 1 )
68 return; 71 return;
69 72
70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); 73 Config cfg( QFileInfo(qApp->argv()[0]).fileName() );
71 cfg.setGroup( key ); 74 cfg.setGroup( key );
72 QFileInfo inf( file ); 75 QFileInfo inf( file );
73 if ( inf.isFile() ) 76 if ( inf.isFile() )
74 cfg.writeEntry("LastDir", inf.dirPath( true ) ); 77 cfg.writeEntry("LastDir", inf.dirPath( true ) );
75 else 78 else
76 cfg.writeEntry("LastDir", file ); 79 cfg.writeEntry("LastDir", file );
77} 80}
78}; 81};
79 82
80/** 83/**
81 * This constructs a modal dialog 84 * This constructs a modal dialog
82 * 85 *
83 * @param caption The caption of the dialog 86 * @param caption The caption of the dialog
84 * @param wid The parent widget 87 * @param wid The parent widget
85 * @param mode The mode of the OFileSelector @see OFileSelector 88 * @param mode The mode of the OFileSelector @see OFileSelector
86 * @param selector The selector of the OFileSelector 89 * @param selector The selector of the OFileSelector
87 * @param dirName the dir or resource to start from 90 * @param dirName the dir or resource to start from
88 * @param fileName a proposed or existing filename 91 * @param fileName a proposed or existing filename
89 * @param mimetypes The mimeTypes 92 * @param mimetypes The mimeTypes
90 */ 93 */
91OFileDialog::OFileDialog(const QString &caption, 94OFileDialog::OFileDialog(const QString &caption,
92 QWidget *wid, int mode, int selector, 95 QWidget *wid, int mode, int selector,
93 const QString &dirName, 96 const QString &dirName,
94 const QString &fileName, 97 const QString &fileName,
95 const QMap<QString,QStringList>& mimetypes ) 98 const QMap<QString,QStringList>& mimetypes )
96 : QDialog( wid, "OFileDialog", true ) 99 : QDialog( wid, "OFileDialog", true )
97{ 100{
98 // QVBoxLayout *lay = new QVBoxLayout(this); 101 // QVBoxLayout *lay = new QVBoxLayout(this);
99 //showMaximized(); 102 //showMaximized();
100 QVBoxLayout *lay = new QVBoxLayout(this ); 103 QVBoxLayout *lay = new QVBoxLayout(this );
101 file = new OFileSelector(this , mode, selector, 104 file = new OFileSelector(this , mode, selector,
102 dirName, fileName, 105 dirName, fileName,
103 mimetypes ); 106 mimetypes );
104 lay->addWidget( file ); 107 lay->addWidget( file );
105 108
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index 4870cd9..6c24f14 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -1,105 +1,108 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Robert Griebl <sandman@handhelds.org> 3 Copyright (C) Robert Griebl <sandman@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
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 Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library 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/* OPIE */ 30/* OPIE */
31#include <opie2/ofontselector.h> 31#include <opie2/ofontselector.h>
32#include <qpe/fontdatabase.h> 32#include <qpe/fontdatabase.h>
33 33
34/* QT */ 34/* QT */
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qlistbox.h> 36#include <qlistbox.h>
37#include <qcombobox.h> 37#include <qcombobox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qmultilineedit.h> 39#include <qmultilineedit.h>
40 40
41 41
42/* TRANSLATOR Opie::Ui::OFontSelector */
43
44
42namespace Opie { 45namespace Opie {
43namespace Ui { 46namespace Ui {
44namespace Internal { 47namespace Internal {
45 48
46class OFontSelectorPrivate 49class OFontSelectorPrivate
47{ 50{
48public: 51public:
49 QListBox * m_font_family_list; 52 QListBox * m_font_family_list;
50 QComboBox * m_font_style_list; 53 QComboBox * m_font_style_list;
51 QComboBox * m_font_size_list; 54 QComboBox * m_font_size_list;
52 QMultiLineEdit *m_preview; 55 QMultiLineEdit *m_preview;
53 56
54 bool m_pointbug : 1; 57 bool m_pointbug : 1;
55 58
56 FontDatabase m_fdb; 59 FontDatabase m_fdb;
57}; 60};
58 61
59class FontListItem : public QListBoxText 62class FontListItem : public QListBoxText
60{ 63{
61public: 64public:
62 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() 65 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText()
63 { 66 {
64 m_name = t; 67 m_name = t;
65 m_styles = styles; 68 m_styles = styles;
66 m_sizes = sizes; 69 m_sizes = sizes;
67 70
68 QString str = t; 71 QString str = t;
69 str [0] = str [0]. upper(); 72 str [0] = str [0]. upper();
70 setText ( str ); 73 setText ( str );
71 } 74 }
72 75
73 QString family() const 76 QString family() const
74 { 77 {
75 return m_name; 78 return m_name;
76 } 79 }
77 80
78 const QStringList &styles() const 81 const QStringList &styles() const
79 { 82 {
80 return m_styles; 83 return m_styles;
81 } 84 }
82 85
83 const QValueList<int> &sizes() const 86 const QValueList<int> &sizes() const
84 { 87 {
85 return m_sizes; 88 return m_sizes;
86 } 89 }
87 90
88private: 91private:
89 QStringList m_styles; 92 QStringList m_styles;
90 QValueList<int> m_sizes; 93 QValueList<int> m_sizes;
91 QString m_name; 94 QString m_name;
92}; 95};
93} 96}
94} 97}
95} 98}
96 99
97 100
98using namespace Opie::Ui; 101using namespace Opie::Ui;
99using namespace Opie::Ui::Internal; 102using namespace Opie::Ui::Internal;
100 103
101static int findItemCB( QComboBox *box, const QString &str ) 104static int findItemCB( QComboBox *box, const QString &str )
102{ 105{
103 for ( int i = 0; i < box->count(); i++ ) 106 for ( int i = 0; i < box->count(); i++ )
104 { 107 {
105 if ( box->text ( i ) == str ) 108 if ( box->text ( i ) == str )