-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 2 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/filesystem.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/libopie/ofileselector.cpp | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 11ce880..2a66494 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -1,182 +1,182 @@ | |||
1 | /* | 1 | /* |
2 | * cardmon.cpp | 2 | * cardmon.cpp |
3 | * | 3 | * |
4 | * --------------------- | 4 | * --------------------- |
5 | * | 5 | * |
6 | * copyright : (c) 2002 by Maximilian Reiss | 6 | * copyright : (c) 2002 by Maximilian Reiss |
7 | * email : max.reiss@gmx.de | 7 | * email : max.reiss@gmx.de |
8 | * based on two apps by Devin Butterfield | 8 | * based on two apps by Devin Butterfield |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "cardmon.h" | 19 | #include "cardmon.h" |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <opie2/odevice.h> | 23 | #include <opie2/odevice.h> |
24 | #include <opie2/oprocess.h> | 24 | #include <opie2/oprocess.h> |
25 | #include <opie2/oresource.h> | 25 | #include <opie2/oresource.h> |
26 | #include <opie2/otaskbarapplet.h> | 26 | #include <opie2/otaskbarapplet.h> |
27 | 27 | ||
28 | #include <qpe/applnk.h> | 28 | #include <qpe/applnk.h> |
29 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
30 | using namespace Opie::Core; | 30 | using namespace Opie::Core; |
31 | using namespace Opie::Ui; | 31 | using namespace Opie::Ui; |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qcopchannel_qws.h> | 34 | #include <qcopchannel_qws.h> |
35 | #include <qpainter.h> | 35 | #include <qpainter.h> |
36 | #include <qfile.h> | 36 | #include <qfile.h> |
37 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
38 | #include <qsound.h> | 38 | #include <qsound.h> |
39 | #include <qtimer.h> | 39 | #include <qtimer.h> |
40 | 40 | ||
41 | /* STD */ | 41 | /* STD */ |
42 | #include <stdio.h> | 42 | #include <stdio.h> |
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include <string.h> | 45 | #include <string.h> |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 47 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
48 | #include <sys/vfs.h> | 48 | #include <sys/vfs.h> |
49 | #include <mntent.h> | 49 | #include <mntent.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ) | 52 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ) |
53 | { | 53 | { |
54 | pm = Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ); | 54 | pm = Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ); |
55 | 55 | ||
56 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); | 56 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); |
57 | connect( pcmciaChannel, | 57 | connect( pcmciaChannel, |
58 | SIGNAL( received(const QCString&,const QByteArray&) ), this, | 58 | SIGNAL( received(const QCString&,const QByteArray&) ), this, |
59 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); | 59 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); |
60 | 60 | ||
61 | QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this ); | 61 | QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this ); |
62 | connect( sdChannel, | 62 | connect( sdChannel, |
63 | SIGNAL( received(const QCString&,const QByteArray&) ), this, | 63 | SIGNAL( received(const QCString&,const QByteArray&) ), this, |
64 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); | 64 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); |
65 | 65 | ||
66 | cardInPcmcia0 = FALSE; | 66 | cardInPcmcia0 = FALSE; |
67 | cardInPcmcia1 = FALSE; | 67 | cardInPcmcia1 = FALSE; |
68 | cardInSd = FALSE; | 68 | cardInSd = FALSE; |
69 | m_process = 0; | 69 | m_process = 0; |
70 | 70 | ||
71 | setFocusPolicy( NoFocus ); | 71 | setFocusPolicy( NoFocus ); |
72 | 72 | ||
73 | setFixedWidth ( AppLnk::smallIconSize() ); | 73 | setFixedWidth ( AppLnk::smallIconSize() ); |
74 | setFixedHeight ( AppLnk::smallIconSize() ); | 74 | setFixedHeight ( AppLnk::smallIconSize() ); |
75 | 75 | ||
76 | getStatusPcmcia( TRUE ); | 76 | getStatusPcmcia( TRUE ); |
77 | getStatusSd( TRUE ); | 77 | getStatusSd( TRUE ); |
78 | repaint( FALSE ); | 78 | repaint( FALSE ); |
79 | popupMenu = 0; | 79 | popupMenu = 0; |
80 | } | 80 | } |
81 | 81 | ||
82 | CardMonitor::~CardMonitor() { | 82 | CardMonitor::~CardMonitor() { |
83 | delete popupMenu; | 83 | delete popupMenu; |
84 | } | 84 | } |
85 | 85 | ||
86 | void CardMonitor::popUp( QString message, QString icon ) { | 86 | void CardMonitor::popUp( QString message, QString icon ) { |
87 | if ( !popupMenu ) { | 87 | if ( !popupMenu ) { |
88 | popupMenu = new QPopupMenu( this ); | 88 | popupMenu = new QPopupMenu( this ); |
89 | } | 89 | } |
90 | 90 | ||
91 | popupMenu->clear(); | 91 | popupMenu->clear(); |
92 | if ( icon.isEmpty() ) { | 92 | if ( icon.isEmpty() ) { |
93 | popupMenu->insertItem( message, 0 ); | 93 | popupMenu->insertItem( message, 0 ); |
94 | } else { | 94 | } else { |
95 | popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ), | 95 | popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ), |
96 | message, 0 ); | 96 | message, 0 ); |
97 | } | 97 | } |
98 | 98 | ||
99 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 99 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
100 | QSize s = popupMenu->sizeHint(); | 100 | QSize s = popupMenu->sizeHint(); |
101 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), | 101 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), |
102 | p.y() - s.height() ), 0 ); | 102 | p.y() - s.height() ), 0 ); |
103 | 103 | ||
104 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); | 104 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); |
105 | } | 105 | } |
106 | 106 | ||
107 | void CardMonitor::popupTimeout() { | 107 | void CardMonitor::popupTimeout() { |
108 | popupMenu->hide(); | 108 | popupMenu->hide(); |
109 | } | 109 | } |
110 | 110 | ||
111 | void CardMonitor::mousePressEvent( QMouseEvent * ) { | 111 | void CardMonitor::mousePressEvent( QMouseEvent * ) { |
112 | QPopupMenu * menu = new QPopupMenu( this ); | 112 | QPopupMenu * menu = new QPopupMenu( this ); |
113 | QStringList cmd; | 113 | QStringList cmd; |
114 | bool execute = true; | 114 | bool execute = true; |
115 | 115 | ||
116 | if ( cardInSd ) { | 116 | if ( cardInSd ) { |
117 | menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ), | 117 | menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ), |
118 | tr( "Eject SD/MMC card" ), 0 ); | 118 | tr( "Eject SD/MMC card" ), 0 ); |
119 | } | 119 | } |
120 | 120 | ||
121 | if ( cardInPcmcia0 ) { | 121 | if ( cardInPcmcia0 ) { |
122 | menu-> | 122 | menu-> |
123 | insertItem( QIconSet | 123 | insertItem( QIconSet |
124 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia0Type, Opie::Core::OResource::SmallIcon ) ), | 124 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia0Type, Opie::Core::OResource::SmallIcon ) ), |
125 | tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 ); | 125 | tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 ); |
126 | } | 126 | } |
127 | 127 | ||
128 | if ( cardInPcmcia1 ) { | 128 | if ( cardInPcmcia1 ) { |
129 | menu-> | 129 | menu-> |
130 | insertItem( QIconSet | 130 | insertItem( QIconSet |
131 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia1Type, Opie::Core::OResource::SmallIcon ) ), | 131 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia1Type, Opie::Core::OResource::SmallIcon ) ), |
132 | tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); | 132 | tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); |
133 | } | 133 | } |
134 | 134 | ||
135 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 135 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
136 | QSize s = menu->sizeHint(); | 136 | QSize s = menu->sizeHint(); |
137 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), | 137 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), |
138 | p.y() - s.height() ), 0 ); | 138 | p.y() - s.height() ), 0 ); |
139 | 139 | ||
140 | if ( opt == 1 ) { | 140 | if ( opt == 1 ) { |
141 | m_commandOrig = PCMCIA_Socket1; | 141 | m_commandOrig = PCMCIA_Socket1; |
142 | cmd << "/sbin/cardctl" << "eject" << "0"; | 142 | cmd << "/sbin/cardctl" << "eject" << "0"; |
143 | } else if ( opt == 0 ) { | 143 | } else if ( opt == 0 ) { |
144 | m_commandOrig = MMC_Socket; | 144 | m_commandOrig = MMC_Socket; |
145 | cmd << "umount" << cardSdName; | 145 | cmd << "umount" << cardSdName; |
146 | } else if ( opt == 2 ) { | 146 | } else if ( opt == 2 ) { |
147 | m_commandOrig = PCMCIA_Socket2; | 147 | m_commandOrig = PCMCIA_Socket2; |
148 | cmd << "/sbin/cardctl" << "eject" << "1"; | 148 | cmd << "/sbin/cardctl" << "eject" << "1"; |
149 | }else | 149 | }else |
150 | execute = false; | 150 | execute = false; |
151 | 151 | ||
152 | if ( execute ) | 152 | if ( execute ) |
153 | execCommand( cmd ); | 153 | execCommand( cmd ); |
154 | 154 | ||
155 | delete menu; | 155 | delete menu; |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | void CardMonitor::cardMessage( const QCString & msg, const QByteArray & ) { | 159 | void CardMonitor::cardMessage( const QCString & msg, const QByteArray & ) { |
160 | if ( msg == "stabChanged()" ) { | 160 | if ( msg == "stabChanged()" ) { |
161 | // odebug << "Pcmcia: stabchanged" << oendl; | 161 | // odebug << "Pcmcia: stabchanged" << oendl; |
162 | getStatusPcmcia(); | 162 | getStatusPcmcia(); |
163 | } else if ( msg == "mtabChanged()" ) { | 163 | } else if ( msg == "mtabChanged()" ) { |
164 | // odebug << "CARDMONAPPLET: mtabchanged" << oendl; | 164 | // odebug << "CARDMONAPPLET: mtabchanged" << oendl; |
165 | getStatusSd(); | 165 | getStatusSd(); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | bool CardMonitor::getStatusPcmcia( int showPopUp ) { | 169 | bool CardMonitor::getStatusPcmcia( int showPopUp ) { |
170 | 170 | ||
171 | bool cardWas0 = cardInPcmcia0; // remember last state | 171 | bool cardWas0 = cardInPcmcia0; // remember last state |
172 | bool cardWas1 = cardInPcmcia1; | 172 | bool cardWas1 = cardInPcmcia1; |
173 | 173 | ||
174 | QString fileName; | 174 | QString fileName; |
175 | 175 | ||
176 | // one of these 3 files should exist | 176 | // one of these 3 files should exist |
177 | if ( QFile::exists( "/var/run/stab" ) ) { | 177 | if ( QFile::exists( "/var/run/stab" ) ) { |
178 | fileName = "/var/run/stab"; | 178 | fileName = "/var/run/stab"; |
179 | } else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { | 179 | } else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { |
180 | fileName = "/var/state/pcmcia/stab"; | 180 | fileName = "/var/state/pcmcia/stab"; |
181 | } else { | 181 | } else { |
182 | fileName = "/var/lib/pcmcia/stab"; | 182 | fileName = "/var/lib/pcmcia/stab"; |
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index a30bd8b..02404e5 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -244,257 +244,257 @@ QWidget* ODocumentFileView::widget( QWidget* parent ) | |||
244 | 244 | ||
245 | return m_selector; | 245 | return m_selector; |
246 | } | 246 | } |
247 | 247 | ||
248 | /* | 248 | /* |
249 | * This is the file system view used | 249 | * This is the file system view used |
250 | * we use a QListView + QListViewItems for it | 250 | * we use a QListView + QListViewItems for it |
251 | */ | 251 | */ |
252 | 252 | ||
253 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 253 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
254 | const QString& path, const QString& date, | 254 | const QString& path, const QString& date, |
255 | const QString& size, const QString& dir, | 255 | const QString& size, const QString& dir, |
256 | bool isLocked, bool isDir ) | 256 | bool isLocked, bool isDir ) |
257 | : QListViewItem( view ), m_dir(dir), m_isDir(isDir), m_locked(isLocked) | 257 | : QListViewItem( view ), m_dir(dir), m_isDir(isDir), m_locked(isLocked) |
258 | { | 258 | { |
259 | setPixmap(0, pixmap ); | 259 | setPixmap(0, pixmap ); |
260 | setText(1, path ); | 260 | setText(1, path ); |
261 | setText(2, size ); | 261 | setText(2, size ); |
262 | setText(3, date ); | 262 | setText(3, date ); |
263 | } | 263 | } |
264 | 264 | ||
265 | OFileSelectorItem::~OFileSelectorItem() | 265 | OFileSelectorItem::~OFileSelectorItem() |
266 | { | 266 | { |
267 | } | 267 | } |
268 | 268 | ||
269 | bool OFileSelectorItem::isLocked()const | 269 | bool OFileSelectorItem::isLocked()const |
270 | { | 270 | { |
271 | return m_locked; | 271 | return m_locked; |
272 | } | 272 | } |
273 | 273 | ||
274 | QString OFileSelectorItem::directory()const | 274 | QString OFileSelectorItem::directory()const |
275 | { | 275 | { |
276 | return m_dir; | 276 | return m_dir; |
277 | } | 277 | } |
278 | 278 | ||
279 | bool OFileSelectorItem::isDir()const | 279 | bool OFileSelectorItem::isDir()const |
280 | { | 280 | { |
281 | return m_isDir; | 281 | return m_isDir; |
282 | } | 282 | } |
283 | 283 | ||
284 | QString OFileSelectorItem::path()const | 284 | QString OFileSelectorItem::path()const |
285 | { | 285 | { |
286 | return text( 1 ); | 286 | return text( 1 ); |
287 | } | 287 | } |
288 | 288 | ||
289 | QString OFileSelectorItem::key( int id, bool )const | 289 | QString OFileSelectorItem::key( int id, bool )const |
290 | { | 290 | { |
291 | QString ke; | 291 | QString ke; |
292 | 292 | ||
293 | /* | 293 | /* |
294 | * id = 0 ||id == 1 : Sort By Name but Directories at Top | 294 | * id = 0 ||id == 1 : Sort By Name but Directories at Top |
295 | * id = 2 : Sort By Size: Prepend '0' to the key | 295 | * id = 2 : Sort By Size: Prepend '0' to the key |
296 | */ | 296 | */ |
297 | if( id == 0 || id == 1 ) | 297 | if( id == 0 || id == 1 ) |
298 | { // name | 298 | { // name |
299 | if( m_isDir ) | 299 | if( m_isDir ) |
300 | { | 300 | { |
301 | ke.append("0" ); | 301 | ke.append("0" ); |
302 | ke.append( text(1) ); | 302 | ke.append( text(1) ); |
303 | } | 303 | } |
304 | else | 304 | else |
305 | { | 305 | { |
306 | ke.append("1" ); | 306 | ke.append("1" ); |
307 | ke.append( text(1) ); | 307 | ke.append( text(1) ); |
308 | } | 308 | } |
309 | return ke; | 309 | return ke; |
310 | }else if(id == 2) { | 310 | }else if(id == 2) { |
311 | return text(2).rightJustify(20, '0'); | 311 | return text(2).rightJustify(20, '0'); |
312 | }else | 312 | }else |
313 | return text( id ); | 313 | return text( id ); |
314 | 314 | ||
315 | } | 315 | } |
316 | 316 | ||
317 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) | 317 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) |
318 | :QWidget( parent ), m_sel( sel ) | 318 | :QWidget( parent ), m_sel( sel ) |
319 | { | 319 | { |
320 | m_all = false; | 320 | m_all = false; |
321 | QVBoxLayout* lay = new QVBoxLayout( this ); | 321 | QVBoxLayout* lay = new QVBoxLayout( this ); |
322 | m_currentDir = startDir; | 322 | m_currentDir = startDir; |
323 | bool bigicons = qApp->desktop()->size().width()>330; | 323 | bool bigicons = qApp->desktop()->size().width()>330; |
324 | 324 | ||
325 | /* | 325 | /* |
326 | * now we add a special bar | 326 | * now we add a special bar |
327 | * One Button For Up | 327 | * One Button For Up |
328 | * Home | 328 | * Home |
329 | * Doc | 329 | * Doc |
330 | * And a dropdown menu with FileSystems | 330 | * And a dropdown menu with FileSystems |
331 | * FUTURE: one to change dir with lineedit | 331 | * FUTURE: one to change dir with lineedit |
332 | * Bookmarks | 332 | * Bookmarks |
333 | * Create Dir | 333 | * Create Dir |
334 | */ | 334 | */ |
335 | QHBox* box = new QHBox(this ); | 335 | QHBox* box = new QHBox(this ); |
336 | box->setBackgroundMode( PaletteButton ); | 336 | box->setBackgroundMode( PaletteButton ); |
337 | box->setSpacing( 0 ); | 337 | box->setSpacing( 0 ); |
338 | 338 | ||
339 | QToolButton *btn = new QToolButton( box ); | 339 | QToolButton *btn = new QToolButton( box ); |
340 | btn->setUsesBigPixmap(bigicons); | 340 | btn->setUsesBigPixmap(bigicons); |
341 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); | 341 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); |
342 | connect(btn, SIGNAL(clicked() ), | 342 | connect(btn, SIGNAL(clicked() ), |
343 | this, SLOT( cdUP() ) ); | 343 | this, SLOT( cdUP() ) ); |
344 | 344 | ||
345 | btn = new QToolButton( box ); | 345 | btn = new QToolButton( box ); |
346 | btn->setUsesBigPixmap(bigicons); | 346 | btn->setUsesBigPixmap(bigicons); |
347 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); | 347 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); |
348 | connect(btn, SIGNAL(clicked() ), | 348 | connect(btn, SIGNAL(clicked() ), |
349 | this, SLOT( cdHome() ) ); | 349 | this, SLOT( cdHome() ) ); |
350 | 350 | ||
351 | btn = new QToolButton( box ); | 351 | btn = new QToolButton( box ); |
352 | btn->setUsesBigPixmap(bigicons); | 352 | btn->setUsesBigPixmap(bigicons); |
353 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); | 353 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); |
354 | connect(btn, SIGNAL(clicked() ), | 354 | connect(btn, SIGNAL(clicked() ), |
355 | this, SLOT(cdDoc() ) ); | 355 | this, SLOT(cdDoc() ) ); |
356 | 356 | ||
357 | m_btnNew = new QToolButton( box ); | 357 | m_btnNew = new QToolButton( box ); |
358 | m_btnNew->setUsesBigPixmap(bigicons); | 358 | m_btnNew->setUsesBigPixmap(bigicons); |
359 | m_btnNew->setPixmap( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ) ); | 359 | m_btnNew->setPixmap( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ) ); |
360 | connect(m_btnNew, SIGNAL(clicked() ), | 360 | connect(m_btnNew, SIGNAL(clicked() ), |
361 | this, SLOT(slotNew() ) ); | 361 | this, SLOT(slotNew() ) ); |
362 | 362 | ||
363 | 363 | ||
364 | m_btnClose = new QToolButton( box ); | 364 | m_btnClose = new QToolButton( box ); |
365 | m_btnClose->setUsesBigPixmap(bigicons); | 365 | m_btnClose->setUsesBigPixmap(bigicons); |
366 | m_btnClose->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); | 366 | m_btnClose->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); |
367 | connect(m_btnClose, SIGNAL(clicked() ), | 367 | connect(m_btnClose, SIGNAL(clicked() ), |
368 | selector(), SIGNAL(closeMe() ) ); | 368 | selector(), SIGNAL(closeMe() ) ); |
369 | 369 | ||
370 | btn = new QToolButton( box ); | 370 | btn = new QToolButton( box ); |
371 | btn->setUsesBigPixmap(bigicons); | 371 | btn->setUsesBigPixmap(bigicons); |
372 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) ); | 372 | btn->setPixmap( Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ) ); |
373 | 373 | ||
374 | m_fsButton = btn; | 374 | m_fsButton = btn; |
375 | /* let's fill device parts */ | 375 | /* let's fill device parts */ |
376 | QPopupMenu* pop = new QPopupMenu(this); | 376 | QPopupMenu* pop = new QPopupMenu(this); |
377 | connect(pop, SIGNAL( activated(int) ), | 377 | connect(pop, SIGNAL( activated(int) ), |
378 | this, SLOT(slotFSActivated(int) ) ); | 378 | this, SLOT(slotFSActivated(int) ) ); |
379 | 379 | ||
380 | StorageInfo storage; | 380 | StorageInfo storage; |
381 | const QList<FileSystem> &fs = storage.fileSystems(); | 381 | const QList<FileSystem> &fs = storage.fileSystems(); |
382 | QListIterator<FileSystem> it(fs); | 382 | QListIterator<FileSystem> it(fs); |
383 | for ( ; it.current(); ++it ) | 383 | for ( ; it.current(); ++it ) |
384 | { | 384 | { |
385 | const QString disk = (*it)->name(); | 385 | const QString disk = (*it)->name(); |
386 | const QString path = (*it)->path(); | 386 | const QString path = (*it)->path(); |
387 | m_dev.insert( disk, path ); | 387 | m_dev.insert( disk, path ); |
388 | pop->insertItem( disk ); | 388 | pop->insertItem( disk ); |
389 | } | 389 | } |
390 | m_fsPop = pop; | 390 | m_fsPop = pop; |
391 | 391 | ||
392 | connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed())); | 392 | connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed())); |
393 | 393 | ||
394 | lay->addWidget( box ); | 394 | lay->addWidget( box ); |
395 | 395 | ||
396 | m_view = new QListView( this ); | 396 | m_view = new QListView( this ); |
397 | 397 | ||
398 | m_view->installEventFilter(this); | 398 | m_view->installEventFilter(this); |
399 | 399 | ||
400 | QPEApplication::setStylusOperation( m_view->viewport(), | 400 | QPEApplication::setStylusOperation( m_view->viewport(), |
401 | QPEApplication::RightOnHold); | 401 | QPEApplication::RightOnHold); |
402 | m_view->addColumn(" " ); | 402 | m_view->addColumn(" " ); |
403 | m_view->addColumn(tr("Name"), 135 ); | 403 | m_view->addColumn(tr("Name"), 135 ); |
404 | m_view->addColumn(tr("Size"), -1 ); | 404 | m_view->addColumn(tr("Size"), -1 ); |
405 | m_view->addColumn(tr("Date"), 60 ); | 405 | m_view->addColumn(tr("Date"), 60 ); |
406 | m_view->addColumn(tr("Mime Type"), -1 ); | 406 | m_view->addColumn(tr("Mime Type"), -1 ); |
407 | 407 | ||
408 | 408 | ||
409 | m_view->setSorting( 1 ); | 409 | m_view->setSorting( 1 ); |
410 | m_view->setAllColumnsShowFocus( TRUE ); | 410 | m_view->setAllColumnsShowFocus( TRUE ); |
411 | 411 | ||
412 | lay->addWidget( m_view, 1000 ); | 412 | lay->addWidget( m_view, 1000 ); |
413 | connectSlots(); | 413 | connectSlots(); |
414 | } | 414 | } |
415 | 415 | ||
416 | void OFileViewFileListView::slotFSpressed() | 416 | void OFileViewFileListView::slotFSpressed() |
417 | { | 417 | { |
418 | m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y())); | 418 | m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y())); |
419 | m_fsButton->setDown(false); | 419 | m_fsButton->setDown(false); |
420 | } | 420 | } |
421 | 421 | ||
422 | OFileViewFileListView::~OFileViewFileListView() | 422 | OFileViewFileListView::~OFileViewFileListView() |
423 | { | 423 | { |
424 | } | 424 | } |
425 | 425 | ||
426 | void OFileViewFileListView::slotNew() | 426 | void OFileViewFileListView::slotNew() |
427 | { | 427 | { |
428 | DocLnk lnk; | 428 | DocLnk lnk; |
429 | emit selector()->newSelected( lnk ); | 429 | emit selector()->newSelected( lnk ); |
430 | } | 430 | } |
431 | 431 | ||
432 | OFileSelectorItem* OFileViewFileListView::currentItem()const | 432 | OFileSelectorItem* OFileViewFileListView::currentItem()const |
433 | { | 433 | { |
434 | QListViewItem* item = m_view->currentItem(); | 434 | QListViewItem* item = m_view->currentItem(); |
435 | if (!item ) | 435 | if (!item ) |
436 | return 0l; | 436 | return 0l; |
437 | 437 | ||
438 | return static_cast<OFileSelectorItem*>(item); | 438 | return static_cast<OFileSelectorItem*>(item); |
439 | } | 439 | } |
440 | 440 | ||
441 | void OFileViewFileListView::reread( bool all ) | 441 | void OFileViewFileListView::reread( bool all ) |
442 | { | 442 | { |
443 | m_view->clear(); | 443 | m_view->clear(); |
444 | 444 | ||
445 | if (selector()->showClose() ) | 445 | if (selector()->showClose() ) |
446 | m_btnClose->show(); | 446 | m_btnClose->show(); |
447 | else | 447 | else |
448 | m_btnClose->hide(); | 448 | m_btnClose->hide(); |
449 | 449 | ||
450 | if (selector()->showNew() ) | 450 | if (selector()->showNew() ) |
451 | m_btnNew->show(); | 451 | m_btnNew->show(); |
452 | else | 452 | else |
453 | m_btnNew->hide(); | 453 | m_btnNew->hide(); |
454 | 454 | ||
455 | m_mimes = selector()->currentMimeType(); | 455 | m_mimes = selector()->currentMimeType(); |
456 | m_all = all; | 456 | m_all = all; |
457 | 457 | ||
458 | QDir dir( m_currentDir ); | 458 | QDir dir( m_currentDir ); |
459 | if (!dir.exists() ) | 459 | if (!dir.exists() ) |
460 | return; | 460 | return; |
461 | 461 | ||
462 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 462 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
463 | int filter; | 463 | int filter; |
464 | filter = QDir::Dirs; | 464 | filter = QDir::Dirs; |
465 | if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR ) | 465 | if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR ) |
466 | filter = filter | QDir::Files | QDir::All; | 466 | filter = filter | QDir::Files | QDir::All; |
467 | 467 | ||
468 | if ( m_all ) | 468 | if ( m_all ) |
469 | filter = filter | QDir::Hidden; | 469 | filter = filter | QDir::Hidden; |
470 | 470 | ||
471 | dir.setFilter( filter ); | 471 | dir.setFilter( filter ); |
472 | 472 | ||
473 | // now go through all files | 473 | // now go through all files |
474 | const QFileInfoList *list = dir.entryInfoList(); | 474 | const QFileInfoList *list = dir.entryInfoList(); |
475 | if (!list) | 475 | if (!list) |
476 | { | 476 | { |
477 | cdUP(); | 477 | cdUP(); |
478 | return; | 478 | return; |
479 | } | 479 | } |
480 | 480 | ||
481 | QFileInfoListIterator it( *list ); | 481 | QFileInfoListIterator it( *list ); |
482 | QFileInfo *fi; | 482 | QFileInfo *fi; |
483 | while( (fi=it.current() ) ) | 483 | while( (fi=it.current() ) ) |
484 | { | 484 | { |
485 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) | 485 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) |
486 | { | 486 | { |
487 | ++it; | 487 | ++it; |
488 | continue; | 488 | continue; |
489 | } | 489 | } |
490 | 490 | ||
491 | /* | 491 | /* |
492 | * It is a symlink we try to resolve it now but don't let us attack by DOS | 492 | * It is a symlink we try to resolve it now but don't let us attack by DOS |
493 | * | 493 | * |
494 | */ | 494 | */ |
495 | if( fi->isSymLink() ) | 495 | if( fi->isSymLink() ) |
496 | { | 496 | { |
497 | QString file = createNewPath(fi->dirPath( true ),fi->readLink()); | 497 | QString file = createNewPath(fi->dirPath( true ),fi->readLink()); |
498 | for( int i = 0; i<=4; i++) | 498 | for( int i = 0; i<=4; i++) |
499 | { // 5 tries to prevent dos | 499 | { // 5 tries to prevent dos |
500 | QFileInfo info( file ); | 500 | QFileInfo info( file ); |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index aa9db52..feda198 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,199 +1,199 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | /* OPIE */ | 14 | /* OPIE */ |
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <opie2/oresource.h> | 16 | #include <opie2/oresource.h> |
17 | #include <qpe/applnk.h> | 17 | #include <qpe/applnk.h> |
18 | #include <qpe/storage.h> | 18 | #include <qpe/storage.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/menubutton.h> | 20 | #include <qpe/menubutton.h> |
21 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
22 | using namespace Opie::Ui; | 22 | using namespace Opie::Ui; |
23 | 23 | ||
24 | /* QT */ | 24 | /* QT */ |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | 32 | ||
33 | /* STD */ | 33 | /* STD */ |
34 | #include <sys/utsname.h> | 34 | #include <sys/utsname.h> |
35 | 35 | ||
36 | void AdvancedFm::init() { | 36 | void AdvancedFm::init() { |
37 | b = false; | 37 | b = false; |
38 | setCaption( tr( "AdvancedFm" ) ); | 38 | setCaption( tr( "AdvancedFm" ) ); |
39 | 39 | ||
40 | QVBoxLayout *layout = new QVBoxLayout( this ); | 40 | QVBoxLayout *layout = new QVBoxLayout( this ); |
41 | layout->setSpacing( 2); | 41 | layout->setSpacing( 2); |
42 | layout->setMargin( 0); // squeeze | 42 | layout->setMargin( 0); // squeeze |
43 | 43 | ||
44 | QMenuBar *menuBar = new QMenuBar(this); | 44 | QMenuBar *menuBar = new QMenuBar(this); |
45 | menuBar->setMargin( 0 ); // squeeze | 45 | menuBar->setMargin( 0 ); // squeeze |
46 | fileMenu = new QPopupMenu( this ); | 46 | fileMenu = new QPopupMenu( this ); |
47 | viewMenu = new QPopupMenu( this ); | 47 | viewMenu = new QPopupMenu( this ); |
48 | // customDirMenu = new QPopupMenu( this ); | 48 | // customDirMenu = new QPopupMenu( this ); |
49 | 49 | ||
50 | layout->addWidget( menuBar ); | 50 | layout->addWidget( menuBar ); |
51 | 51 | ||
52 | menuBar->insertItem( tr( "File" ), fileMenu); | 52 | menuBar->insertItem( tr( "File" ), fileMenu); |
53 | menuBar->insertItem( tr( "View" ), viewMenu); | 53 | menuBar->insertItem( tr( "View" ), viewMenu); |
54 | 54 | ||
55 | bool useBigIcon = qApp->desktop()->size().width() > 330; | 55 | bool useBigIcon = qApp->desktop()->size().width() > 330; |
56 | 56 | ||
57 | cdUpButton = new QToolButton( 0,"cdUpButton"); | 57 | cdUpButton = new QToolButton( 0,"cdUpButton"); |
58 | cdUpButton->setUsesBigPixmap( useBigIcon ); | 58 | cdUpButton->setUsesBigPixmap( useBigIcon ); |
59 | cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); | 59 | cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); |
60 | cdUpButton->setAutoRaise( true ); | 60 | cdUpButton->setAutoRaise( true ); |
61 | menuBar->insertItem( cdUpButton ); | 61 | menuBar->insertItem( cdUpButton ); |
62 | 62 | ||
63 | qpeDirButton= new QToolButton( 0,"QPEButton"); | 63 | qpeDirButton= new QToolButton( 0,"QPEButton"); |
64 | qpeDirButton->setUsesBigPixmap( useBigIcon ); | 64 | qpeDirButton->setUsesBigPixmap( useBigIcon ); |
65 | qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) ); | 65 | qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) ); |
66 | qpeDirButton->setAutoRaise( true ); | 66 | qpeDirButton->setAutoRaise( true ); |
67 | menuBar->insertItem( qpeDirButton ); | 67 | menuBar->insertItem( qpeDirButton ); |
68 | 68 | ||
69 | cfButton = new QToolButton( 0, "CFButton"); | 69 | cfButton = new QToolButton( 0, "CFButton"); |
70 | cfButton->setUsesBigPixmap( useBigIcon ); | 70 | cfButton->setUsesBigPixmap( useBigIcon ); |
71 | cfButton->setPixmap( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) ); | 71 | cfButton->setPixmap( Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ) ); |
72 | cfButton->setAutoRaise( true ); | 72 | cfButton->setAutoRaise( true ); |
73 | menuBar->insertItem( cfButton ); | 73 | menuBar->insertItem( cfButton ); |
74 | 74 | ||
75 | sdButton = new QToolButton( 0, "SDButton"); | 75 | sdButton = new QToolButton( 0, "SDButton"); |
76 | sdButton->setUsesBigPixmap( useBigIcon ); | 76 | sdButton->setUsesBigPixmap( useBigIcon ); |
77 | sdButton->setPixmap( Opie::Core::OResource::loadPixmap( "advancedfm/sdcard", Opie::Core::OResource::SmallIcon ) ); | 77 | sdButton->setPixmap( Opie::Core::OResource::loadPixmap( "advancedfm/sdcard", Opie::Core::OResource::SmallIcon ) ); |
78 | sdButton->setAutoRaise( true ); | 78 | sdButton->setAutoRaise( true ); |
79 | menuBar->insertItem( sdButton ); | 79 | menuBar->insertItem( sdButton ); |
80 | 80 | ||
81 | docButton = new QToolButton( 0,"docsButton"); | 81 | docButton = new QToolButton( 0,"docsButton"); |
82 | docButton->setUsesBigPixmap( useBigIcon ); | 82 | docButton->setUsesBigPixmap( useBigIcon ); |
83 | docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); | 83 | docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); |
84 | docButton->setAutoRaise( true ); | 84 | docButton->setAutoRaise( true ); |
85 | menuBar->insertItem( docButton ); | 85 | menuBar->insertItem( docButton ); |
86 | 86 | ||
87 | homeButton = new QToolButton( 0, "homeButton"); | 87 | homeButton = new QToolButton( 0, "homeButton"); |
88 | homeButton->setUsesBigPixmap( useBigIcon ); | 88 | homeButton->setUsesBigPixmap( useBigIcon ); |
89 | homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); | 89 | homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); |
90 | homeButton->setAutoRaise( true ); | 90 | homeButton->setAutoRaise( true ); |
91 | menuBar->insertItem( homeButton ); | 91 | menuBar->insertItem( homeButton ); |
92 | 92 | ||
93 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 93 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
94 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 94 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
95 | fileMenu->insertSeparator(); | 95 | fileMenu->insertSeparator(); |
96 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); | 96 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); |
97 | fileMenu->insertSeparator(); | 97 | fileMenu->insertSeparator(); |
98 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 98 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
99 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 99 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
100 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 100 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
101 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 101 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
102 | fileMenu->insertSeparator(); | 102 | fileMenu->insertSeparator(); |
103 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 103 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
104 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 104 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
105 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 105 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
106 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 106 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
107 | fileMenu->setCheckable(TRUE); | 107 | fileMenu->setCheckable(TRUE); |
108 | 108 | ||
109 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); | 109 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); |
110 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); | 110 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); |
111 | viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); | 111 | viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); |
112 | // viewMenu->insertSeparator(); | 112 | // viewMenu->insertSeparator(); |
113 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 113 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
114 | viewMenu->setCheckable(true); | 114 | viewMenu->setCheckable(true); |
115 | viewMenu->setItemChecked( viewMenu->idAt(0), true); | 115 | viewMenu->setItemChecked( viewMenu->idAt(0), true); |
116 | viewMenu->setItemChecked( viewMenu->idAt(1), false); | 116 | viewMenu->setItemChecked( viewMenu->idAt(1), false); |
117 | 117 | ||
118 | s_addBookmark = tr("Bookmark Directory"); | 118 | s_addBookmark = tr("Bookmark Directory"); |
119 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 119 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
120 | 120 | ||
121 | // menuButton->insertItem(""); | 121 | // menuButton->insertItem(""); |
122 | 122 | ||
123 | // customDirMenu->insertItem(tr("Add This Directory")); | 123 | // customDirMenu->insertItem(tr("Add This Directory")); |
124 | // customDirMenu->insertItem(tr("Remove This Directory")); | 124 | // customDirMenu->insertItem(tr("Remove This Directory")); |
125 | // customDirMenu->insertSeparator(); | 125 | // customDirMenu->insertSeparator(); |
126 | 126 | ||
127 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later | 127 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later |
128 | CBHB->setMargin( 0 ); | 128 | CBHB->setMargin( 0 ); |
129 | CBHB->setSpacing( 1 ); | 129 | CBHB->setSpacing( 1 ); |
130 | 130 | ||
131 | menuButton = new MenuButton( this ); | 131 | menuButton = new MenuButton( this ); |
132 | 132 | ||
133 | menuButton->setUseLabel(false); | 133 | menuButton->setUseLabel(false); |
134 | menuButton->setMaximumWidth( 20 ); | 134 | menuButton->setMaximumWidth( 20 ); |
135 | menuButton->insertItem( s_addBookmark); | 135 | menuButton->insertItem( s_addBookmark); |
136 | menuButton->insertItem( s_removeBookmark); | 136 | menuButton->insertItem( s_removeBookmark); |
137 | menuButton->insertSeparator(); | 137 | menuButton->insertSeparator(); |
138 | // menuButton->setFocusPolicy(NoFocus); | 138 | // menuButton->setFocusPolicy(NoFocus); |
139 | CBHB->addWidget( menuButton ); | 139 | CBHB->addWidget( menuButton ); |
140 | 140 | ||
141 | customDirsToMenu(); | 141 | customDirsToMenu(); |
142 | 142 | ||
143 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 143 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
144 | currentPathCombo->setEditable(TRUE); | 144 | currentPathCombo->setEditable(TRUE); |
145 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 145 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
146 | // currentPathCombo->setFocusPolicy(NoFocus); | 146 | // currentPathCombo->setFocusPolicy(NoFocus); |
147 | CBHB->addWidget( currentPathCombo ); | 147 | CBHB->addWidget( currentPathCombo ); |
148 | 148 | ||
149 | layout->addLayout( CBHB ); | 149 | layout->addLayout( CBHB ); |
150 | 150 | ||
151 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); | 151 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
152 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 152 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
153 | layout->addWidget( TabWidget, 4 ); | 153 | layout->addWidget( TabWidget, 4 ); |
154 | 154 | ||
155 | tab = new QWidget( TabWidget, "tab" ); | 155 | tab = new QWidget( TabWidget, "tab" ); |
156 | tabLayout = new QGridLayout( tab ); | 156 | tabLayout = new QGridLayout( tab ); |
157 | tabLayout->setSpacing( 2); | 157 | tabLayout->setSpacing( 2); |
158 | tabLayout->setMargin( 2); | 158 | tabLayout->setMargin( 2); |
159 | 159 | ||
160 | Local_View = new QListView( tab, "Local_View" ); | 160 | Local_View = new QListView( tab, "Local_View" ); |
161 | Local_View->addColumn( tr("File"),130); | 161 | Local_View->addColumn( tr("File"),130); |
162 | Local_View->addColumn( tr("Size"),-1); | 162 | Local_View->addColumn( tr("Size"),-1); |
163 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 163 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
164 | Local_View->addColumn( tr("Date"),-1); | 164 | Local_View->addColumn( tr("Date"),-1); |
165 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 165 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
166 | Local_View->setAllColumnsShowFocus(TRUE); | 166 | Local_View->setAllColumnsShowFocus(TRUE); |
167 | Local_View->setMultiSelection( TRUE ); | 167 | Local_View->setMultiSelection( TRUE ); |
168 | Local_View->setSelectionMode(QListView::Extended); | 168 | Local_View->setSelectionMode(QListView::Extended); |
169 | Local_View->setFocusPolicy(StrongFocus); | 169 | Local_View->setFocusPolicy(StrongFocus); |
170 | Local_View->installEventFilter( this ); | 170 | Local_View->installEventFilter( this ); |
171 | 171 | ||
172 | QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); | 172 | QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); |
173 | 173 | ||
174 | tabLayout->addWidget( Local_View, 0, 0 ); | 174 | tabLayout->addWidget( Local_View, 0, 0 ); |
175 | 175 | ||
176 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); | 176 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
177 | // TabWidget->insertTab( tab, tr("1")); | 177 | // TabWidget->insertTab( tab, tr("1")); |
178 | 178 | ||
179 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 179 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
180 | tabLayout_2 = new QGridLayout( tab_2 ); | 180 | tabLayout_2 = new QGridLayout( tab_2 ); |
181 | tabLayout_2->setSpacing( 2); | 181 | tabLayout_2->setSpacing( 2); |
182 | tabLayout_2->setMargin( 2); | 182 | tabLayout_2->setMargin( 2); |
183 | 183 | ||
184 | Remote_View = new QListView( tab_2, "Remote_View" ); | 184 | Remote_View = new QListView( tab_2, "Remote_View" ); |
185 | Remote_View->addColumn( tr("File"),130); | 185 | Remote_View->addColumn( tr("File"),130); |
186 | Remote_View->addColumn( tr("Size"),-1); | 186 | Remote_View->addColumn( tr("Size"),-1); |
187 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 187 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
188 | Remote_View->addColumn( tr("Date"),-1); | 188 | Remote_View->addColumn( tr("Date"),-1); |
189 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 189 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
190 | Remote_View->setAllColumnsShowFocus(TRUE); | 190 | Remote_View->setAllColumnsShowFocus(TRUE); |
191 | Remote_View->setMultiSelection( TRUE ); | 191 | Remote_View->setMultiSelection( TRUE ); |
192 | Remote_View->setSelectionMode(QListView::Extended); | 192 | Remote_View->setSelectionMode(QListView::Extended); |
193 | Remote_View->setFocusPolicy(StrongFocus); | 193 | Remote_View->setFocusPolicy(StrongFocus); |
194 | Remote_View->installEventFilter( this ); | 194 | Remote_View->installEventFilter( this ); |
195 | 195 | ||
196 | QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); | 196 | QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); |
197 | 197 | ||
198 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 198 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
199 | 199 | ||
diff --git a/noncore/graphics/opie-eye/gui/filesystem.cpp b/noncore/graphics/opie-eye/gui/filesystem.cpp index d84e9f8..9448843 100644 --- a/noncore/graphics/opie-eye/gui/filesystem.cpp +++ b/noncore/graphics/opie-eye/gui/filesystem.cpp | |||
@@ -1,66 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qtoolbar.h> | 7 | #include <qtoolbar.h> |
8 | 8 | ||
9 | #include <opie2/oresource.h> | 9 | #include <opie2/oresource.h> |
10 | 10 | ||
11 | #include <qpe/storage.h> | 11 | #include <qpe/storage.h> |
12 | 12 | ||
13 | 13 | ||
14 | #include "filesystem.h" | 14 | #include "filesystem.h" |
15 | 15 | ||
16 | PFileSystem::PFileSystem( QToolBar* bar) | 16 | PFileSystem::PFileSystem( QToolBar* bar) |
17 | : QToolButton( bar ) | 17 | : QToolButton( bar ) |
18 | { | 18 | { |
19 | setIconSet( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) ); | 19 | setIconSet( Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ) ); |
20 | 20 | ||
21 | m_pop = new QPopupMenu( this ); | 21 | m_pop = new QPopupMenu( this ); |
22 | connect( m_pop, SIGNAL( activated( int ) ), | 22 | connect( m_pop, SIGNAL( activated( int ) ), |
23 | this, SLOT(slotSelectDir( int ) ) ); | 23 | this, SLOT(slotSelectDir( int ) ) ); |
24 | 24 | ||
25 | m_storage = new StorageInfo(); | 25 | m_storage = new StorageInfo(); |
26 | connect(m_storage, SIGNAL(disksChanged() ), | 26 | connect(m_storage, SIGNAL(disksChanged() ), |
27 | this, SLOT( changed() ) ); | 27 | this, SLOT( changed() ) ); |
28 | changed(); | 28 | changed(); |
29 | 29 | ||
30 | connect(this,SIGNAL(pressed()),SLOT(slotPopUp())); | 30 | connect(this,SIGNAL(pressed()),SLOT(slotPopUp())); |
31 | } | 31 | } |
32 | 32 | ||
33 | PFileSystem::~PFileSystem() { | 33 | PFileSystem::~PFileSystem() { |
34 | delete m_storage; | 34 | delete m_storage; |
35 | } | 35 | } |
36 | 36 | ||
37 | 37 | ||
38 | void PFileSystem::changed() { | 38 | void PFileSystem::changed() { |
39 | m_pop->clear(); | 39 | m_pop->clear(); |
40 | m_dev.clear(); | 40 | m_dev.clear(); |
41 | 41 | ||
42 | /* home dir, too */ | 42 | /* home dir, too */ |
43 | QString f = getenv( "HOME" ); | 43 | QString f = getenv( "HOME" ); |
44 | if (!f.isEmpty()) { | 44 | if (!f.isEmpty()) { |
45 | m_dev.insert("Home directory",f); | 45 | m_dev.insert("Home directory",f); |
46 | m_pop->insertItem("Home directory"); | 46 | m_pop->insertItem("Home directory"); |
47 | } | 47 | } |
48 | 48 | ||
49 | const QList<FileSystem> &fs = m_storage->fileSystems(); | 49 | const QList<FileSystem> &fs = m_storage->fileSystems(); |
50 | QListIterator<FileSystem> it(fs ); | 50 | QListIterator<FileSystem> it(fs ); |
51 | for ( ; it.current(); ++it ) { | 51 | for ( ; it.current(); ++it ) { |
52 | const QString disk = (*it)->name(); | 52 | const QString disk = (*it)->name(); |
53 | const QString path = (*it)->path(); | 53 | const QString path = (*it)->path(); |
54 | m_dev.insert( disk, path ); | 54 | m_dev.insert( disk, path ); |
55 | m_pop->insertItem( disk ); | 55 | m_pop->insertItem( disk ); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | void PFileSystem::slotPopUp() { | 59 | void PFileSystem::slotPopUp() { |
60 | m_pop->exec(QCursor::pos()); | 60 | m_pop->exec(QCursor::pos()); |
61 | setDown(false); | 61 | setDown(false); |
62 | } | 62 | } |
63 | 63 | ||
64 | void PFileSystem::slotSelectDir( int id ) { | 64 | void PFileSystem::slotSelectDir( int id ) { |
65 | emit changeDir( m_dev[m_pop->text(id )] ); | 65 | emit changeDir( m_dev[m_pop->text(id )] ); |
66 | } | 66 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index d4c5b42..2cf687b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -620,248 +620,248 @@ void PMainWindow::setupActions() | |||
620 | 620 | ||
621 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 621 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
622 | m_aAutoRotate->setOn(true); | 622 | m_aAutoRotate->setOn(true); |
623 | } else { | 623 | } else { |
624 | m_aAutoRotate->setOn(false); | 624 | m_aAutoRotate->setOn(false); |
625 | } | 625 | } |
626 | if (autoSave) { | 626 | if (autoSave) { |
627 | m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); | 627 | m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); |
628 | } | 628 | } |
629 | connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 629 | connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
630 | 630 | ||
631 | m_aUnscaled = new QAction( tr( "Show images unscaled" ), | 631 | m_aUnscaled = new QAction( tr( "Show images unscaled" ), |
632 | Opie::Core::OResource::loadPixmap( "1to1", Opie::Core::OResource::SmallIcon ), | 632 | Opie::Core::OResource::loadPixmap( "1to1", Opie::Core::OResource::SmallIcon ), |
633 | 0, 0, this, 0, true ); | 633 | 0, 0, this, 0, true ); |
634 | m_aUnscaled->setToggleAction(true); | 634 | m_aUnscaled->setToggleAction(true); |
635 | connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 635 | connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
636 | if (autoSave) { | 636 | if (autoSave) { |
637 | m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); | 637 | m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); |
638 | } else { | 638 | } else { |
639 | m_aUnscaled->setOn(false); | 639 | m_aUnscaled->setOn(false); |
640 | } | 640 | } |
641 | 641 | ||
642 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), | 642 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), |
643 | Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon ), | 643 | Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon ), |
644 | 0, 0, this, 0, true ); | 644 | 0, 0, this, 0, true ); |
645 | m_aZoomer->setToggleAction(true); | 645 | m_aZoomer->setToggleAction(true); |
646 | if (autoSave) { | 646 | if (autoSave) { |
647 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); | 647 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); |
648 | } else { | 648 | } else { |
649 | m_aZoomer->setOn (true); | 649 | m_aZoomer->setOn (true); |
650 | } | 650 | } |
651 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 651 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
652 | m_gDisplayType->insert(m_aAutoRotate); | 652 | m_gDisplayType->insert(m_aAutoRotate); |
653 | m_gDisplayType->insert(m_aUnscaled); | 653 | m_gDisplayType->insert(m_aUnscaled); |
654 | m_gDisplayType->insert(m_aZoomer); | 654 | m_gDisplayType->insert(m_aZoomer); |
655 | 655 | ||
656 | m_hGroup = new QActionGroup(this,"actioncollection",false); | 656 | m_hGroup = new QActionGroup(this,"actioncollection",false); |
657 | m_hGroup->insert(m_aFullScreen); | 657 | m_hGroup->insert(m_aFullScreen); |
658 | 658 | ||
659 | if (!m_SmallWindow) { | 659 | if (!m_SmallWindow) { |
660 | m_aForceSmall = new QAction(tr("Dont show seperate windows"), | 660 | m_aForceSmall = new QAction(tr("Dont show seperate windows"), |
661 | Opie::Core::OResource::loadPixmap( "AppsIcon", Opie::Core::OResource::SmallIcon ), | 661 | Opie::Core::OResource::loadPixmap( "AppsIcon", Opie::Core::OResource::SmallIcon ), |
662 | 0, 0, this, 0, true); | 662 | 0, 0, this, 0, true); |
663 | m_aForceSmall->setToggleAction(true); | 663 | m_aForceSmall->setToggleAction(true); |
664 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); | 664 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); |
665 | } else { | 665 | } else { |
666 | m_aForceSmall = 0; | 666 | m_aForceSmall = 0; |
667 | } | 667 | } |
668 | m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); | 668 | m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); |
669 | connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); | 669 | connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); |
670 | m_IncBrightness = new QAction(tr("Increase brightness by 5"), | 670 | m_IncBrightness = new QAction(tr("Increase brightness by 5"), |
671 | Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ), | 671 | Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ), |
672 | 0, 0, this, 0, false); | 672 | 0, 0, this, 0, false); |
673 | m_DecBrightness = new QAction(tr("Decrease brightness by 5"), | 673 | m_DecBrightness = new QAction(tr("Decrease brightness by 5"), |
674 | Opie::Core::OResource::loadPixmap( "down", Opie::Core::OResource::SmallIcon ), | 674 | Opie::Core::OResource::loadPixmap( "down", Opie::Core::OResource::SmallIcon ), |
675 | 0, 0, this, 0, false); | 675 | 0, 0, this, 0, false); |
676 | m_hBright = new QActionGroup(this,"actioncollection",false), | 676 | m_hBright = new QActionGroup(this,"actioncollection",false), |
677 | m_hBright->insert(m_setCurrentBrightness); | 677 | m_hBright->insert(m_setCurrentBrightness); |
678 | m_hBright->insert(m_IncBrightness); | 678 | m_hBright->insert(m_IncBrightness); |
679 | m_hBright->insert(m_DecBrightness); | 679 | m_hBright->insert(m_DecBrightness); |
680 | } | 680 | } |
681 | 681 | ||
682 | void PMainWindow::setupBrightness() | 682 | void PMainWindow::setupBrightness() |
683 | { | 683 | { |
684 | if (!m_disp) { | 684 | if (!m_disp) { |
685 | return; | 685 | return; |
686 | } | 686 | } |
687 | bool reshow=false; | 687 | bool reshow=false; |
688 | if (m_disp->isVisible()&&m_disp->fullScreen()) { | 688 | if (m_disp->isVisible()&&m_disp->fullScreen()) { |
689 | m_disp->hide(); | 689 | m_disp->hide(); |
690 | reshow = true; | 690 | reshow = true; |
691 | } | 691 | } |
692 | int lb = m_disp->Intensity(); | 692 | int lb = m_disp->Intensity(); |
693 | if (Valuebox(0,-100,100,lb,lb)) { | 693 | if (Valuebox(0,-100,100,lb,lb)) { |
694 | m_disp->setIntensity(lb,true); | 694 | m_disp->setIntensity(lb,true); |
695 | } | 695 | } |
696 | if (reshow) { | 696 | if (reshow) { |
697 | m_disp->showFullScreen(); | 697 | m_disp->showFullScreen(); |
698 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 698 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
699 | } | 699 | } |
700 | } | 700 | } |
701 | 701 | ||
702 | void PMainWindow::setupToolbar() | 702 | void PMainWindow::setupToolbar() |
703 | { | 703 | { |
704 | toolBar = new QToolBar( this ); | 704 | toolBar = new QToolBar( this ); |
705 | addToolBar(toolBar); | 705 | addToolBar(toolBar); |
706 | toolBar->setHorizontalStretchable( true ); | 706 | toolBar->setHorizontalStretchable( true ); |
707 | setToolBarsMovable( false ); | 707 | setToolBarsMovable( false ); |
708 | m_aDirUp->addTo( toolBar ); | 708 | m_aDirUp->addTo( toolBar ); |
709 | 709 | ||
710 | fsButton = new PFileSystem( toolBar ); | 710 | fsButton = new PFileSystem( toolBar ); |
711 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 711 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
712 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 712 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
713 | connect( this, SIGNAL( changeDir( const QString& ) ), | 713 | connect( this, SIGNAL( changeDir( const QString& ) ), |
714 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 714 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
715 | 715 | ||
716 | if (m_aBeam) { | 716 | if (m_aBeam) { |
717 | m_aBeam->addTo( toolBar ); | 717 | m_aBeam->addTo( toolBar ); |
718 | } | 718 | } |
719 | m_aShowInfo->addTo(toolBar); | 719 | m_aShowInfo->addTo(toolBar); |
720 | m_aTrash->addTo(toolBar); | 720 | m_aTrash->addTo(toolBar); |
721 | 721 | ||
722 | m_gDisplayType->addTo(toolBar); | 722 | m_gDisplayType->addTo(toolBar); |
723 | 723 | ||
724 | if (!m_SmallWindow) { | 724 | if (!m_SmallWindow) { |
725 | m_gPrevNext->addTo(toolBar); | 725 | m_gPrevNext->addTo(toolBar); |
726 | } else { | 726 | } else { |
727 | m_gPrevNext->setEnabled(false); | 727 | m_gPrevNext->setEnabled(false); |
728 | } | 728 | } |
729 | } | 729 | } |
730 | 730 | ||
731 | void PMainWindow::setupMenu() | 731 | void PMainWindow::setupMenu() |
732 | { | 732 | { |
733 | fileMenu = new QPopupMenu( menuBar() ); | 733 | fileMenu = new QPopupMenu( menuBar() ); |
734 | menuBar()->insertItem( tr( "File" ), fileMenu ); | 734 | menuBar()->insertItem( tr( "File" ), fileMenu ); |
735 | dispMenu = new QPopupMenu( menuBar() ); | 735 | dispMenu = new QPopupMenu( menuBar() ); |
736 | menuBar()->insertItem( tr( "Show" ), dispMenu ); | 736 | menuBar()->insertItem( tr( "Show" ), dispMenu ); |
737 | settingsMenu = new QPopupMenu( menuBar() ); | 737 | settingsMenu = new QPopupMenu( menuBar() ); |
738 | menuBar()->insertItem( tr( "Settings" ), settingsMenu ); | 738 | menuBar()->insertItem( tr( "Settings" ), settingsMenu ); |
739 | 739 | ||
740 | m_aViewfile->addTo(fileMenu); | 740 | m_aViewfile->addTo(fileMenu); |
741 | m_aShowInfo->addTo(fileMenu); | 741 | m_aShowInfo->addTo(fileMenu); |
742 | m_aStartSlide->addTo(fileMenu); | 742 | m_aStartSlide->addTo(fileMenu); |
743 | 743 | ||
744 | fileMenu->insertSeparator(); | 744 | fileMenu->insertSeparator(); |
745 | m_aDirUp->addTo( fileMenu ); | 745 | m_aDirUp->addTo( fileMenu ); |
746 | 746 | ||
747 | fsMenu = new QPopupMenu(fileMenu); | 747 | fsMenu = new QPopupMenu(fileMenu); |
748 | fileMenu->insertItem(Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ), | 748 | fileMenu->insertItem(Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ), |
749 | tr("Select filesystem"),fsMenu); | 749 | tr("Select filesystem"),fsMenu); |
750 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); | 750 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); |
751 | dirChanged(); | 751 | dirChanged(); |
752 | 752 | ||
753 | if ( m_aBeam ) { | 753 | if ( m_aBeam ) { |
754 | fileMenu->insertSeparator(); | 754 | fileMenu->insertSeparator(); |
755 | m_aBeam->addTo( fileMenu ); | 755 | m_aBeam->addTo( fileMenu ); |
756 | } | 756 | } |
757 | fileMenu->insertSeparator(); | 757 | fileMenu->insertSeparator(); |
758 | m_aTrash->addTo(fileMenu); | 758 | m_aTrash->addTo(fileMenu); |
759 | 759 | ||
760 | listviewMenu = new QPopupMenu(dispMenu); | 760 | listviewMenu = new QPopupMenu(dispMenu); |
761 | dispMenu->insertItem(Opie::Core::OResource::loadPixmap("opie-eye/opie-eye-thumb", Opie::Core::OResource::SmallIcon), | 761 | dispMenu->insertItem(Opie::Core::OResource::loadPixmap("opie-eye/opie-eye-thumb", Opie::Core::OResource::SmallIcon), |
762 | tr("Listview mode"),listviewMenu); | 762 | tr("Listview mode"),listviewMenu); |
763 | m_gListViewMode->addTo(listviewMenu); | 763 | m_gListViewMode->addTo(listviewMenu); |
764 | dispMenu->insertSeparator(); | 764 | dispMenu->insertSeparator(); |
765 | m_aFullScreen->addTo(dispMenu); | 765 | m_aFullScreen->addTo(dispMenu); |
766 | m_gDisplayType->addTo(dispMenu); | 766 | m_gDisplayType->addTo(dispMenu); |
767 | dispMenu->insertSeparator(); | 767 | dispMenu->insertSeparator(); |
768 | m_gPrevNext->addTo(dispMenu); | 768 | m_gPrevNext->addTo(dispMenu); |
769 | dispMenu->insertSeparator(); | 769 | dispMenu->insertSeparator(); |
770 | m_hBright->addTo(dispMenu); | 770 | m_hBright->addTo(dispMenu); |
771 | m_hBright->setEnabled(false); | 771 | m_hBright->setEnabled(false); |
772 | 772 | ||
773 | if (m_aForceSmall) { | 773 | if (m_aForceSmall) { |
774 | dispMenu->insertSeparator(); | 774 | dispMenu->insertSeparator(); |
775 | m_aForceSmall->addTo(dispMenu); | 775 | m_aForceSmall->addTo(dispMenu); |
776 | } | 776 | } |
777 | 777 | ||
778 | m_aSetup->addTo(settingsMenu); | 778 | m_aSetup->addTo(settingsMenu); |
779 | m_aHideToolbar->addTo(settingsMenu); | 779 | m_aHideToolbar->addTo(settingsMenu); |
780 | } | 780 | } |
781 | 781 | ||
782 | void PMainWindow::listviewselected(QAction*which) | 782 | void PMainWindow::listviewselected(QAction*which) |
783 | { | 783 | { |
784 | if (!which || which->isOn()==false) return; | 784 | if (!which || which->isOn()==false) return; |
785 | int val = 1; | 785 | int val = 1; |
786 | 786 | ||
787 | if (which==m_aDirName) { | 787 | if (which==m_aDirName) { |
788 | val = 3; | 788 | val = 3; |
789 | } else if (which==m_aDirShort) { | 789 | } else if (which==m_aDirShort) { |
790 | val = 2; | 790 | val = 2; |
791 | } else if (which==m_aDirLong) { | 791 | } else if (which==m_aDirLong) { |
792 | val = 1; | 792 | val = 1; |
793 | } | 793 | } |
794 | emit changeListMode(val); | 794 | emit changeListMode(val); |
795 | } | 795 | } |
796 | 796 | ||
797 | void PMainWindow::readConfig() | 797 | void PMainWindow::readConfig() |
798 | { | 798 | { |
799 | autoSave =m_cfg->readBoolEntry("savestatus",true); | 799 | autoSave =m_cfg->readBoolEntry("savestatus",true); |
800 | m_Intensity = m_cfg->readNumEntry("intensity",0); | 800 | m_Intensity = m_cfg->readNumEntry("intensity",0); |
801 | } | 801 | } |
802 | 802 | ||
803 | void PMainWindow::polish() | 803 | void PMainWindow::polish() |
804 | { | 804 | { |
805 | if (m_disp) { | 805 | if (m_disp) { |
806 | odebug << "======================\n" | 806 | odebug << "======================\n" |
807 | << "Called via setdocument\n" | 807 | << "Called via setdocument\n" |
808 | << "======================" << oendl; | 808 | << "======================" << oendl; |
809 | m_setDocCalled = true; | 809 | m_setDocCalled = true; |
810 | m_view->setDoccalled(true); | 810 | m_view->setDoccalled(true); |
811 | m_disp->setCloseIfHide(true); | 811 | m_disp->setCloseIfHide(true); |
812 | } else { | 812 | } else { |
813 | m_setDocCalled = false; | 813 | m_setDocCalled = false; |
814 | m_view->setDoccalled(false); | 814 | m_view->setDoccalled(false); |
815 | } | 815 | } |
816 | m_polishDone = true; | 816 | m_polishDone = true; |
817 | QMainWindow::polish(); | 817 | QMainWindow::polish(); |
818 | if (m_setDocCalled) { | 818 | if (m_setDocCalled) { |
819 | if (m_aFullScreen->isOn()) { | 819 | if (m_aFullScreen->isOn()) { |
820 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); | 820 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); |
821 | } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 821 | } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
822 | } | 822 | } |
823 | } | 823 | } |
824 | } | 824 | } |
825 | 825 | ||
826 | void PMainWindow::slotForceSmall(bool how) | 826 | void PMainWindow::slotForceSmall(bool how) |
827 | { | 827 | { |
828 | odebug << "Disable separate windows: " << how << oendl; | 828 | odebug << "Disable separate windows: " << how << oendl; |
829 | if (m_stack) { | 829 | if (m_stack) { |
830 | if (how) { | 830 | if (how) { |
831 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); | 831 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); |
832 | } else { | 832 | } else { |
833 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 833 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
834 | } | 834 | } |
835 | } | 835 | } |
836 | if (autoSave) { | 836 | if (autoSave) { |
837 | m_cfg->writeEntry("dontshowseperate",how); | 837 | m_cfg->writeEntry("dontshowseperate",how); |
838 | } | 838 | } |
839 | } | 839 | } |
840 | 840 | ||
841 | bool PMainWindow::Valuebox(QWidget*parent,int min, int max, int current,int&store) | 841 | bool PMainWindow::Valuebox(QWidget*parent,int min, int max, int current,int&store) |
842 | { | 842 | { |
843 | QDialog dlg(parent,"brightnessbox",true); | 843 | QDialog dlg(parent,"brightnessbox",true); |
844 | QVBoxLayout * m_MainLayout; | 844 | QVBoxLayout * m_MainLayout; |
845 | QGridLayout * m_IntensityLayout; | 845 | QGridLayout * m_IntensityLayout; |
846 | QSpinBox * m_Intensity; | 846 | QSpinBox * m_Intensity; |
847 | QLabel * m_IntensityLabel; | 847 | QLabel * m_IntensityLabel; |
848 | 848 | ||
849 | m_MainLayout = new QVBoxLayout( &dlg, 11, 6, "m_MainLayout"); | 849 | m_MainLayout = new QVBoxLayout( &dlg, 11, 6, "m_MainLayout"); |
850 | m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout"); | 850 | m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout"); |
851 | m_Intensity = new QSpinBox( &dlg, "m_Intensity" ); | 851 | m_Intensity = new QSpinBox( &dlg, "m_Intensity" ); |
852 | m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); | 852 | m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); |
853 | m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); | 853 | m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); |
854 | m_Intensity->setMaxValue( max ); | 854 | m_Intensity->setMaxValue( max ); |
855 | m_Intensity->setMinValue(min); | 855 | m_Intensity->setMinValue(min); |
856 | m_Intensity->setValue( current ); | 856 | m_Intensity->setValue( current ); |
857 | m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); | 857 | m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); |
858 | m_IntensityLabel = new QLabel( &dlg, "m_IntensityLabel" ); | 858 | m_IntensityLabel = new QLabel( &dlg, "m_IntensityLabel" ); |
859 | m_IntensityLabel->setText(QObject::tr("Display brightness:")); | 859 | m_IntensityLabel->setText(QObject::tr("Display brightness:")); |
860 | m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 ); | 860 | m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 ); |
861 | m_MainLayout->addLayout(m_IntensityLayout); | 861 | m_MainLayout->addLayout(m_IntensityLayout); |
862 | if (dlg.exec()) { | 862 | if (dlg.exec()) { |
863 | store = m_Intensity->value(); | 863 | store = m_Intensity->value(); |
864 | return true; | 864 | return true; |
865 | } | 865 | } |
866 | return false; | 866 | return false; |
867 | } | 867 | } |
diff --git a/noncore/unsupported/libopie/ofileselector.cpp b/noncore/unsupported/libopie/ofileselector.cpp index 2a6aed0..3bb85e0 100644 --- a/noncore/unsupported/libopie/ofileselector.cpp +++ b/noncore/unsupported/libopie/ofileselector.cpp | |||
@@ -107,257 +107,257 @@ void ODocumentFileView::reread() { | |||
107 | m_selector->setCloseVisible( showClose() ); | 107 | m_selector->setCloseVisible( showClose() ); |
108 | m_selector->filter = currentMimeType().join(";"); | 108 | m_selector->filter = currentMimeType().join(";"); |
109 | m_selector->reread(); | 109 | m_selector->reread(); |
110 | } | 110 | } |
111 | int ODocumentFileView::fileCount()const { | 111 | int ODocumentFileView::fileCount()const { |
112 | if (!m_selector) | 112 | if (!m_selector) |
113 | return -1; | 113 | return -1; |
114 | 114 | ||
115 | return m_selector->fileCount(); | 115 | return m_selector->fileCount(); |
116 | } | 116 | } |
117 | DocLnk ODocumentFileView::selectedDocument()const { | 117 | DocLnk ODocumentFileView::selectedDocument()const { |
118 | if (!m_selector) | 118 | if (!m_selector) |
119 | return DocLnk(); | 119 | return DocLnk(); |
120 | 120 | ||
121 | return m_selector->selectedDocument(); | 121 | return m_selector->selectedDocument(); |
122 | } | 122 | } |
123 | QWidget* ODocumentFileView::widget( QWidget* parent ) { | 123 | QWidget* ODocumentFileView::widget( QWidget* parent ) { |
124 | if (!m_selector ) { | 124 | if (!m_selector ) { |
125 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); | 125 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); |
126 | QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), | 126 | QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), |
127 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); | 127 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); |
128 | QObject::connect(m_selector, SIGNAL(closeMe() ), | 128 | QObject::connect(m_selector, SIGNAL(closeMe() ), |
129 | selector(), SIGNAL(closeMe() ) ); | 129 | selector(), SIGNAL(closeMe() ) ); |
130 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), | 130 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), |
131 | selector(), SIGNAL(newSelected(const DocLnk&) ) ); | 131 | selector(), SIGNAL(newSelected(const DocLnk&) ) ); |
132 | } | 132 | } |
133 | 133 | ||
134 | return m_selector; | 134 | return m_selector; |
135 | } | 135 | } |
136 | 136 | ||
137 | /* | 137 | /* |
138 | * This is the file system view used | 138 | * This is the file system view used |
139 | * we use a QListView + QListViewItems for it | 139 | * we use a QListView + QListViewItems for it |
140 | */ | 140 | */ |
141 | 141 | ||
142 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 142 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
143 | const QString& path, const QString& date, | 143 | const QString& path, const QString& date, |
144 | const QString& size, const QString& dir, | 144 | const QString& size, const QString& dir, |
145 | bool isLocked, bool isDir ) | 145 | bool isLocked, bool isDir ) |
146 | : QListViewItem( view ) | 146 | : QListViewItem( view ) |
147 | { | 147 | { |
148 | setPixmap(0, pixmap ); | 148 | setPixmap(0, pixmap ); |
149 | setText(1, path ); | 149 | setText(1, path ); |
150 | setText(2, size ); | 150 | setText(2, size ); |
151 | setText(3, date ); | 151 | setText(3, date ); |
152 | m_isDir = isDir; | 152 | m_isDir = isDir; |
153 | m_dir = dir; | 153 | m_dir = dir; |
154 | m_locked = isLocked; | 154 | m_locked = isLocked; |
155 | } | 155 | } |
156 | OFileSelectorItem::~OFileSelectorItem() { | 156 | OFileSelectorItem::~OFileSelectorItem() { |
157 | 157 | ||
158 | } | 158 | } |
159 | bool OFileSelectorItem::isLocked()const { | 159 | bool OFileSelectorItem::isLocked()const { |
160 | return m_locked; | 160 | return m_locked; |
161 | } | 161 | } |
162 | QString OFileSelectorItem::directory()const { | 162 | QString OFileSelectorItem::directory()const { |
163 | return m_dir; | 163 | return m_dir; |
164 | } | 164 | } |
165 | bool OFileSelectorItem::isDir()const { | 165 | bool OFileSelectorItem::isDir()const { |
166 | return m_isDir; | 166 | return m_isDir; |
167 | } | 167 | } |
168 | QString OFileSelectorItem::path()const { | 168 | QString OFileSelectorItem::path()const { |
169 | return text( 1 ); | 169 | return text( 1 ); |
170 | } | 170 | } |
171 | QString OFileSelectorItem::key( int id, bool )const { | 171 | QString OFileSelectorItem::key( int id, bool )const { |
172 | QString ke; | 172 | QString ke; |
173 | if( id == 0 || id == 1 ){ // name | 173 | if( id == 0 || id == 1 ){ // name |
174 | if( m_isDir ){ | 174 | if( m_isDir ){ |
175 | ke.append("0" ); | 175 | ke.append("0" ); |
176 | ke.append( text(1) ); | 176 | ke.append( text(1) ); |
177 | }else{ | 177 | }else{ |
178 | ke.append("1" ); | 178 | ke.append("1" ); |
179 | ke.append( text(1) ); | 179 | ke.append( text(1) ); |
180 | } | 180 | } |
181 | return ke; | 181 | return ke; |
182 | }else | 182 | }else |
183 | return text( id ); | 183 | return text( id ); |
184 | 184 | ||
185 | } | 185 | } |
186 | 186 | ||
187 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, | 187 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, |
188 | OFileSelector* sel) | 188 | OFileSelector* sel) |
189 | : QWidget( parent ), m_sel( sel ) { | 189 | : QWidget( parent ), m_sel( sel ) { |
190 | m_all = false; | 190 | m_all = false; |
191 | QVBoxLayout* lay = new QVBoxLayout( this ); | 191 | QVBoxLayout* lay = new QVBoxLayout( this ); |
192 | m_currentDir = startDir; | 192 | m_currentDir = startDir; |
193 | 193 | ||
194 | /* | 194 | /* |
195 | * now we add a special bar | 195 | * now we add a special bar |
196 | * One Button For Up | 196 | * One Button For Up |
197 | * Home | 197 | * Home |
198 | * Doc | 198 | * Doc |
199 | * And a dropdown menu with FileSystems | 199 | * And a dropdown menu with FileSystems |
200 | * FUTURE: one to change dir with lineedit | 200 | * FUTURE: one to change dir with lineedit |
201 | * Bookmarks | 201 | * Bookmarks |
202 | * Create Dir | 202 | * Create Dir |
203 | */ | 203 | */ |
204 | QHBox* box = new QHBox(this ); | 204 | QHBox* box = new QHBox(this ); |
205 | box->setBackgroundMode( PaletteButton ); | 205 | box->setBackgroundMode( PaletteButton ); |
206 | box->setSpacing( 0 ); | 206 | box->setSpacing( 0 ); |
207 | 207 | ||
208 | QToolButton *btn = new QToolButton( box ); | 208 | QToolButton *btn = new QToolButton( box ); |
209 | btn->setIconSet( Resource::loadIconSet("up") ); | 209 | btn->setIconSet( Resource::loadIconSet("up") ); |
210 | connect(btn, SIGNAL(clicked() ), | 210 | connect(btn, SIGNAL(clicked() ), |
211 | this, SLOT( cdUP() ) ); | 211 | this, SLOT( cdUP() ) ); |
212 | 212 | ||
213 | btn = new QToolButton( box ); | 213 | btn = new QToolButton( box ); |
214 | btn->setIconSet( Resource::loadIconSet("home") ); | 214 | btn->setIconSet( Resource::loadIconSet("home") ); |
215 | connect(btn, SIGNAL(clicked() ), | 215 | connect(btn, SIGNAL(clicked() ), |
216 | this, SLOT( cdHome() ) ); | 216 | this, SLOT( cdHome() ) ); |
217 | 217 | ||
218 | btn = new QToolButton( box ); | 218 | btn = new QToolButton( box ); |
219 | btn->setIconSet( Resource::loadIconSet("DocsIcon") ); | 219 | btn->setIconSet( Resource::loadIconSet("DocsIcon") ); |
220 | connect(btn, SIGNAL(clicked() ), | 220 | connect(btn, SIGNAL(clicked() ), |
221 | this, SLOT(cdDoc() ) ); | 221 | this, SLOT(cdDoc() ) ); |
222 | 222 | ||
223 | m_btnNew = new QToolButton( box ); | 223 | m_btnNew = new QToolButton( box ); |
224 | m_btnNew->setIconSet( Resource::loadIconSet("new") ); | 224 | m_btnNew->setIconSet( Resource::loadIconSet("new") ); |
225 | connect(m_btnNew, SIGNAL(clicked() ), | 225 | connect(m_btnNew, SIGNAL(clicked() ), |
226 | this, SLOT(slotNew() ) ); | 226 | this, SLOT(slotNew() ) ); |
227 | 227 | ||
228 | 228 | ||
229 | m_btnClose = new QToolButton( box ); | 229 | m_btnClose = new QToolButton( box ); |
230 | m_btnClose->setIconSet( Resource::loadIconSet("close") ); | 230 | m_btnClose->setIconSet( Resource::loadIconSet("close") ); |
231 | connect(m_btnClose, SIGNAL(clicked() ), | 231 | connect(m_btnClose, SIGNAL(clicked() ), |
232 | selector(), SIGNAL(closeMe() ) ); | 232 | selector(), SIGNAL(closeMe() ) ); |
233 | 233 | ||
234 | btn = new QToolButton( box ); | 234 | btn = new QToolButton( box ); |
235 | btn->setIconSet( Resource::loadIconSet("cardmon/pcmcia") ); | 235 | btn->setIconSet( Resource::loadIconSet("pcmcia") ); |
236 | 236 | ||
237 | /* let's fill device parts */ | 237 | /* let's fill device parts */ |
238 | QPopupMenu* pop = new QPopupMenu(this); | 238 | QPopupMenu* pop = new QPopupMenu(this); |
239 | connect(pop, SIGNAL( activated(int) ), | 239 | connect(pop, SIGNAL( activated(int) ), |
240 | this, SLOT(slotFSActivated(int) ) ); | 240 | this, SLOT(slotFSActivated(int) ) ); |
241 | 241 | ||
242 | StorageInfo storage; | 242 | StorageInfo storage; |
243 | const QList<FileSystem> &fs = storage.fileSystems(); | 243 | const QList<FileSystem> &fs = storage.fileSystems(); |
244 | QListIterator<FileSystem> it(fs); | 244 | QListIterator<FileSystem> it(fs); |
245 | for ( ; it.current(); ++it ) { | 245 | for ( ; it.current(); ++it ) { |
246 | const QString disk = (*it)->name(); | 246 | const QString disk = (*it)->name(); |
247 | const QString path = (*it)->path(); | 247 | const QString path = (*it)->path(); |
248 | m_dev.insert( disk, path ); | 248 | m_dev.insert( disk, path ); |
249 | pop->insertItem( disk ); | 249 | pop->insertItem( disk ); |
250 | } | 250 | } |
251 | m_fsPop = pop; | 251 | m_fsPop = pop; |
252 | 252 | ||
253 | 253 | ||
254 | btn->setPopup( pop ); | 254 | btn->setPopup( pop ); |
255 | 255 | ||
256 | lay->addWidget( box ); | 256 | lay->addWidget( box ); |
257 | 257 | ||
258 | m_view = new QListView( this ); | 258 | m_view = new QListView( this ); |
259 | 259 | ||
260 | m_view->installEventFilter(this); | 260 | m_view->installEventFilter(this); |
261 | 261 | ||
262 | QPEApplication::setStylusOperation( m_view->viewport(), | 262 | QPEApplication::setStylusOperation( m_view->viewport(), |
263 | QPEApplication::RightOnHold); | 263 | QPEApplication::RightOnHold); |
264 | m_view->addColumn(" " ); | 264 | m_view->addColumn(" " ); |
265 | m_view->addColumn(tr("Name"), 135 ); | 265 | m_view->addColumn(tr("Name"), 135 ); |
266 | m_view->addColumn(tr("Size"), -1 ); | 266 | m_view->addColumn(tr("Size"), -1 ); |
267 | m_view->addColumn(tr("Date"), 60 ); | 267 | m_view->addColumn(tr("Date"), 60 ); |
268 | m_view->addColumn(tr("Mime Type"), -1 ); | 268 | m_view->addColumn(tr("Mime Type"), -1 ); |
269 | 269 | ||
270 | 270 | ||
271 | m_view->setSorting( 1 ); | 271 | m_view->setSorting( 1 ); |
272 | m_view->setAllColumnsShowFocus( TRUE ); | 272 | m_view->setAllColumnsShowFocus( TRUE ); |
273 | 273 | ||
274 | lay->addWidget( m_view, 1000 ); | 274 | lay->addWidget( m_view, 1000 ); |
275 | connectSlots(); | 275 | connectSlots(); |
276 | } | 276 | } |
277 | OFileViewFileListView::~OFileViewFileListView() { | 277 | OFileViewFileListView::~OFileViewFileListView() { |
278 | } | 278 | } |
279 | void OFileViewFileListView::slotNew() { | 279 | void OFileViewFileListView::slotNew() { |
280 | DocLnk lnk; | 280 | DocLnk lnk; |
281 | emit selector()->newSelected( lnk ); | 281 | emit selector()->newSelected( lnk ); |
282 | } | 282 | } |
283 | OFileSelectorItem* OFileViewFileListView::currentItem()const{ | 283 | OFileSelectorItem* OFileViewFileListView::currentItem()const{ |
284 | QListViewItem* item = m_view->currentItem(); | 284 | QListViewItem* item = m_view->currentItem(); |
285 | if (!item ) | 285 | if (!item ) |
286 | return 0l; | 286 | return 0l; |
287 | 287 | ||
288 | return static_cast<OFileSelectorItem*>(item); | 288 | return static_cast<OFileSelectorItem*>(item); |
289 | } | 289 | } |
290 | void OFileViewFileListView::reread( bool all ) { | 290 | void OFileViewFileListView::reread( bool all ) { |
291 | m_view->clear(); | 291 | m_view->clear(); |
292 | 292 | ||
293 | if (selector()->showClose() ) | 293 | if (selector()->showClose() ) |
294 | m_btnClose->show(); | 294 | m_btnClose->show(); |
295 | else | 295 | else |
296 | m_btnClose->hide(); | 296 | m_btnClose->hide(); |
297 | 297 | ||
298 | if (selector()->showNew() ) | 298 | if (selector()->showNew() ) |
299 | m_btnNew->show(); | 299 | m_btnNew->show(); |
300 | else | 300 | else |
301 | m_btnNew->hide(); | 301 | m_btnNew->hide(); |
302 | 302 | ||
303 | m_mimes = selector()->currentMimeType(); | 303 | m_mimes = selector()->currentMimeType(); |
304 | m_all = all; | 304 | m_all = all; |
305 | 305 | ||
306 | QDir dir( m_currentDir ); | 306 | QDir dir( m_currentDir ); |
307 | if (!dir.exists() ) | 307 | if (!dir.exists() ) |
308 | return; | 308 | return; |
309 | 309 | ||
310 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 310 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
311 | int filter; | 311 | int filter; |
312 | if (m_all ) | 312 | if (m_all ) |
313 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 313 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
314 | else | 314 | else |
315 | filter = QDir::Files | QDir::Dirs | QDir::All; | 315 | filter = QDir::Files | QDir::Dirs | QDir::All; |
316 | dir.setFilter( filter ); | 316 | dir.setFilter( filter ); |
317 | 317 | ||
318 | // now go through all files | 318 | // now go through all files |
319 | const QFileInfoList *list = dir.entryInfoList(); | 319 | const QFileInfoList *list = dir.entryInfoList(); |
320 | if (!list) { | 320 | if (!list) { |
321 | cdUP(); | 321 | cdUP(); |
322 | return; | 322 | return; |
323 | } | 323 | } |
324 | QFileInfoListIterator it( *list ); | 324 | QFileInfoListIterator it( *list ); |
325 | QFileInfo *fi; | 325 | QFileInfo *fi; |
326 | while( (fi=it.current() ) ){ | 326 | while( (fi=it.current() ) ){ |
327 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ | 327 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ |
328 | ++it; | 328 | ++it; |
329 | continue; | 329 | continue; |
330 | } | 330 | } |
331 | 331 | ||
332 | /* | 332 | /* |
333 | * It is a symlink we try to resolve it now but don't let us attack by DOS | 333 | * It is a symlink we try to resolve it now but don't let us attack by DOS |
334 | * | 334 | * |
335 | */ | 335 | */ |
336 | if( fi->isSymLink() ){ | 336 | if( fi->isSymLink() ){ |
337 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | 337 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); |
338 | for( int i = 0; i<=4; i++) { // 5 tries to prevent dos | 338 | for( int i = 0; i<=4; i++) { // 5 tries to prevent dos |
339 | QFileInfo info( file ); | 339 | QFileInfo info( file ); |
340 | if( !info.exists() ){ | 340 | if( !info.exists() ){ |
341 | addSymlink( fi, TRUE ); | 341 | addSymlink( fi, TRUE ); |
342 | break; | 342 | break; |
343 | }else if( info.isDir() ){ | 343 | }else if( info.isDir() ){ |
344 | addDir( fi, TRUE ); | 344 | addDir( fi, TRUE ); |
345 | break; | 345 | break; |
346 | }else if( info.isFile() ){ | 346 | }else if( info.isFile() ){ |
347 | addFile( fi, TRUE ); | 347 | addFile( fi, TRUE ); |
348 | break; | 348 | break; |
349 | }else if( info.isSymLink() ){ | 349 | }else if( info.isSymLink() ){ |
350 | file = info.dirPath(true ) + "/" + info.readLink() ; | 350 | file = info.dirPath(true ) + "/" + info.readLink() ; |
351 | break; | 351 | break; |
352 | }else if( i == 4){ // couldn't resolve symlink add it as symlink | 352 | }else if( i == 4){ // couldn't resolve symlink add it as symlink |
353 | addSymlink( fi ); | 353 | addSymlink( fi ); |
354 | } | 354 | } |
355 | } // off for loop for symlink resolving | 355 | } // off for loop for symlink resolving |
356 | }else if( fi->isDir() ) | 356 | }else if( fi->isDir() ) |
357 | addDir( fi ); | 357 | addDir( fi ); |
358 | else if( fi->isFile() ) | 358 | else if( fi->isFile() ) |
359 | addFile( fi ); | 359 | addFile( fi ); |
360 | 360 | ||
361 | ++it; | 361 | ++it; |
362 | } // of while loop | 362 | } // of while loop |
363 | m_view->sort(); | 363 | m_view->sort(); |