summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-04-12 00:10:00 (UTC)
committer harlekin <harlekin>2002-04-12 00:10:00 (UTC)
commit26efd0a7135834626b4e6f275e57e85a97abd34f (patch) (unidiff)
treeb803f31e222d68f6acdfef9a10e6ccae683d4cb9
parenta1615d98bdd7430e0533c0325dfdc39bf6627ab2 (diff)
downloadopie-26efd0a7135834626b4e6f275e57e85a97abd34f.zip
opie-26efd0a7135834626b4e6f275e57e85a97abd34f.tar.gz
opie-26efd0a7135834626b4e6f275e57e85a97abd34f.tar.bz2
take parent size
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index bc7c6c2..c3a3514 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -1,177 +1,179 @@
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 Holger Freyther <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 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#include <qnamespace.h> 29#include <qnamespace.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qhbox.h> 32#include <qhbox.h>
33#include <qvbox.h> 33#include <qvbox.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qwidgetstack.h> 35#include <qwidgetstack.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qcheckbox.h> 37#include <qcheckbox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qheader.h> 39#include <qheader.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qaction.h> 42#include <qaction.h>
43#include <qpopupmenu.h> 43#include <qpopupmenu.h>
44#include <qcursor.h> 44#include <qcursor.h>
45 45
46#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
47#include <qpe/fileselector.h> 47#include <qpe/fileselector.h>
48#include <qpe/applnk.h> 48#include <qpe/applnk.h>
49#include <qpe/global.h> 49#include <qpe/global.h>
50#include <qpe/mimetype.h> 50#include <qpe/mimetype.h>
51#include <qpe/resource.h> 51#include <qpe/resource.h>
52#include <qpe/storage.h> 52#include <qpe/storage.h>
53 53
54#include <unistd.h> 54#include <unistd.h>
55#include <stdlib.h> 55#include <stdlib.h>
56#include <sys/stat.h> 56#include <sys/stat.h>
57 57
58#include "ofileselector.h" 58#include "ofileselector.h"
59 59
60QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 60QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
61 61
62namespace { 62namespace {
63 63
64 int indexByString( const QComboBox *box, const QString &str ){ 64 int indexByString( const QComboBox *box, const QString &str ){
65 int index= -1; 65 int index= -1;
66 for(int i= 0; i < box->count(); i++ ){ 66 for(int i= 0; i < box->count(); i++ ){
67 qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() ); 67 qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() );
68 if( str == box->text(i ) ){ 68 if( str == box->text(i ) ){
69 index= i; 69 index= i;
70 break; 70 break;
71 } 71 }
72 } 72 }
73 return index; 73 return index;
74 } 74 }
75 75
76}; 76};
77 77
78 78
79OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, 79OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName,
80 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) 80 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid )
81{ 81{
82
83 resize(wid->width(),wid->height());
82 m_selector = selector; 84 m_selector = selector;
83 m_currentDir = dirName; 85 m_currentDir = dirName;
84 m_name = fileName; 86 m_name = fileName;
85 m_mimetypes = mimetypes; 87 m_mimetypes = mimetypes;
86 if( mimetypes.isEmpty() ) 88 if( mimetypes.isEmpty() )
87 m_autoMime = true; 89 m_autoMime = true;
88 90
89 m_mode = mode; 91 m_mode = mode;
90 m_shTool = true; 92 m_shTool = true;
91 m_shPerm = true; 93 m_shPerm = true;
92 m_shLne = true; 94 m_shLne = true;
93 m_shChooser = true; 95 m_shChooser = true;
94 m_shYesNo = true; 96 m_shYesNo = true;
95 // for FILESELECTOR only view is interesting 97 // for FILESELECTOR only view is interesting
96 m_location = 0; 98 m_location = 0;
97 m_homeButton = 0; 99 m_homeButton = 0;
98 m_docButton = 0; 100 m_docButton = 0;
99 m_hideButton = 0; 101 m_hideButton = 0;
100 m_ok = 0; 102 m_ok = 0;
101 m_cancel = 0; 103 m_cancel = 0;
102 m_reread = 0; 104 m_reread = 0;
103 m_up = 0; 105 m_up = 0;
104 m_View = 0; 106 m_View = 0;
105 m_select = 0; 107 m_select = 0;
106 m_stack = 0; 108 m_stack = 0;
107 109
108 m_select = 0; 110 m_select = 0;
109 m_stack = 0; 111 m_stack = 0;
110 m_lay = 0; 112 m_lay = 0;
111 m_boxToolbar = 0; 113 m_boxToolbar = 0;
112 m_boxOk = 0; 114 m_boxOk = 0;
113 m_edit = 0; 115 m_edit = 0;
114 116
115 m_fnLabel = 0; 117 m_fnLabel = 0;
116 m_checkPerm = 0; 118 m_checkPerm = 0;
117 m_mimeCheck = 0; 119 m_mimeCheck = 0;
118 m_viewCheck = 0; 120 m_viewCheck = 0;
119 121
120 m_pseudo = 0; 122 m_pseudo = 0;
121 m_pseudoLayout = 0; 123 m_pseudoLayout = 0;
122 124
123 m_dir = true; 125 m_dir = true;
124 m_files = true; 126 m_files = true;
125 m_custom = 0; 127 m_custom = 0;
126 m_showPopup = true; 128 m_showPopup = true;
127 129
128 if(m_pixmaps == 0 ) // init the pixmaps 130 if(m_pixmaps == 0 ) // init the pixmaps
129 initPics(); 131 initPics();
130 132
131 m_lay = new QVBoxLayout(this); 133 m_lay = new QVBoxLayout(this);
132 init(); 134 init();
133 m_edit->setText( fileName ); 135 m_edit->setText( fileName );
134} 136}
135void OFileSelector::initPics() 137void OFileSelector::initPics()
136{ 138{
137 qWarning("init pics" ); 139 qWarning("init pics" );
138 m_pixmaps = new QMap<QString,QPixmap>; 140 m_pixmaps = new QMap<QString,QPixmap>;
139 QPixmap pm = Resource::loadPixmap( "folder" ); 141 QPixmap pm = Resource::loadPixmap( "folder" );
140 QPixmap lnk = Resource::loadPixmap( "symlink" ); 142 QPixmap lnk = Resource::loadPixmap( "symlink" );
141 QPainter painter( &pm ); 143 QPainter painter( &pm );
142 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 144 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
143 pm.setMask( pm.createHeuristicMask( FALSE ) ); 145 pm.setMask( pm.createHeuristicMask( FALSE ) );
144 m_pixmaps->insert("dirsymlink", pm ); 146 m_pixmaps->insert("dirsymlink", pm );
145 147
146 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 148 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
147 QPainter pen(&pm2 ); 149 QPainter pen(&pm2 );
148 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 150 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
149 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 151 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
150 m_pixmaps->insert("symlinkedlocked", pm2 ); 152 m_pixmaps->insert("symlinkedlocked", pm2 );
151 153
152}; 154};
153// let's initialize the gui 155// let's initialize the gui
154/** 156/**
155 -------------------- 157 --------------------
156 | cmbBox Button | 158 | cmbBox Button |
157 -------------------- 159 --------------------
158 | FileSlector | 160 | FileSlector |
159 | or | 161 | or |
160 | OSelector | 162 | OSelector |
161 | | 163 | |
162 | | 164 | |
163 ____________________ 165 ____________________
164 | LineEdit | 166 | LineEdit |
165 ____________________ 167 ____________________
166 | Permission Bar | 168 | Permission Bar |
167 ____________________ 169 ____________________
168 | ViewChoose | 170 | ViewChoose |
169 ____________________ 171 ____________________
170 | Save Cancel| 172 | Save Cancel|
171 ____________________ 173 ____________________
172 */ 174 */
173void OFileSelector::delItems() 175void OFileSelector::delItems()
174{ 176{
175 QLayoutIterator it = m_lay->iterator(); 177 QLayoutIterator it = m_lay->iterator();
176 while ( it.current() != 0 ){ 178 while ( it.current() != 0 ){
177 it.deleteCurrent(); 179 it.deleteCurrent();