-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 4ced52d..c07a1e5 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -200,9 +200,8 @@ void PIconView::initKeys() { | |||
200 | void PIconView::slotDirUp() { | 200 | void PIconView::slotDirUp() { |
201 | QDir dir( m_path ); | 201 | QDir dir( m_path ); |
202 | dir.cdUp(); | 202 | dir.cdUp(); |
203 | slotChangeDir( dir.absPath() ); | 203 | slotChangeDir( dir.absPath() ); |
204 | |||
205 | } | 204 | } |
206 | 205 | ||
207 | /* | 206 | /* |
208 | * change the dir | 207 | * change the dir |
@@ -214,13 +213,20 @@ void PIconView::slotChangeDir(const QString& path) { | |||
214 | PDirLister *lister = currentView()->dirLister(); | 213 | PDirLister *lister = currentView()->dirLister(); |
215 | if (!lister ) | 214 | if (!lister ) |
216 | return; | 215 | return; |
217 | 216 | ||
217 | /* | ||
218 | * Say what we want and take what we get | ||
219 | */ | ||
218 | lister->setStartPath( path ); | 220 | lister->setStartPath( path ); |
219 | m_path = lister->currentPath(); | 221 | m_path = lister->currentPath(); |
220 | 222 | ||
221 | m_view->viewport()->setUpdatesEnabled( false ); | 223 | m_view->viewport()->setUpdatesEnabled( false ); |
222 | m_view->clear(); | 224 | m_view->clear(); |
225 | |||
226 | /* | ||
227 | * add files and folders | ||
228 | */ | ||
223 | addFolders( lister->folders() ); | 229 | addFolders( lister->folders() ); |
224 | addFiles( lister->files() ); | 230 | addFiles( lister->files() ); |
225 | m_view->viewport()->setUpdatesEnabled( true ); | 231 | m_view->viewport()->setUpdatesEnabled( true ); |
226 | 232 | ||
@@ -231,8 +237,12 @@ void PIconView::slotChangeDir(const QString& path) { | |||
231 | // looks ugly | 237 | // looks ugly |
232 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); | 238 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); |
233 | } | 239 | } |
234 | 240 | ||
241 | /** | ||
242 | * get the current file name | ||
243 | * @param isDir see if this is a dir or real file | ||
244 | */ | ||
235 | QString PIconView::currentFileName(bool &isDir)const { | 245 | QString PIconView::currentFileName(bool &isDir)const { |
236 | isDir = false; | 246 | isDir = false; |
237 | QIconViewItem* _it = m_view->currentItem(); | 247 | QIconViewItem* _it = m_view->currentItem(); |
238 | if ( !_it ) | 248 | if ( !_it ) |
@@ -257,8 +267,12 @@ void PIconView::slotTrash() { | |||
257 | 267 | ||
258 | currentView()->dirLister()->deleteImage( pa ); | 268 | currentView()->dirLister()->deleteImage( pa ); |
259 | delete m_view->currentItem(); | 269 | delete m_view->currentItem(); |
260 | } | 270 | } |
271 | |||
272 | /* | ||
273 | * see what views are available | ||
274 | */ | ||
261 | void PIconView::loadViews() { | 275 | void PIconView::loadViews() { |
262 | ViewMap::Iterator it; | 276 | ViewMap::Iterator it; |
263 | ViewMap* map = viewMap(); | 277 | ViewMap* map = viewMap(); |
264 | for ( it = map->begin(); it != map->end(); ++it ) | 278 | for ( it = map->begin(); it != map->end(); ++it ) |
@@ -268,8 +282,11 @@ void PIconView::loadViews() { | |||
268 | void PIconView::resetView() { | 282 | void PIconView::resetView() { |
269 | slotViewChanged(m_views->currentItem()); | 283 | slotViewChanged(m_views->currentItem()); |
270 | } | 284 | } |
271 | 285 | ||
286 | /* | ||
287 | *swicth view reloadDir and connect signals | ||
288 | */ | ||
272 | void PIconView::slotViewChanged( int i) { | 289 | void PIconView::slotViewChanged( int i) { |
273 | if (!m_views->count() ) { | 290 | if (!m_views->count() ) { |
274 | setCurrentView( 0l); | 291 | setCurrentView( 0l); |
275 | return; | 292 | return; |
@@ -302,8 +319,11 @@ void PIconView::slotReloadDir() { | |||
302 | slotChangeDir( m_path ); | 319 | slotChangeDir( m_path ); |
303 | } | 320 | } |
304 | 321 | ||
305 | 322 | ||
323 | /* | ||
324 | * add files and folders | ||
325 | */ | ||
306 | void PIconView::addFolders( const QStringList& lst) { | 326 | void PIconView::addFolders( const QStringList& lst) { |
307 | QStringList::ConstIterator it; | 327 | QStringList::ConstIterator it; |
308 | 328 | ||
309 | for(it=lst.begin(); it != lst.end(); ++it ) | 329 | for(it=lst.begin(); it != lst.end(); ++it ) |
@@ -318,8 +338,11 @@ void PIconView::addFiles( const QStringList& lst) { | |||
318 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); | 338 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); |
319 | 339 | ||
320 | } | 340 | } |
321 | 341 | ||
342 | /* | ||
343 | * user clicked on the item. Change dir or view | ||
344 | */ | ||
322 | void PIconView::slotClicked(QIconViewItem* _it) { | 345 | void PIconView::slotClicked(QIconViewItem* _it) { |
323 | if(!_it ) | 346 | if(!_it ) |
324 | return; | 347 | return; |
325 | 348 | ||
@@ -329,8 +352,12 @@ void PIconView::slotClicked(QIconViewItem* _it) { | |||
329 | else // view image | 352 | else // view image |
330 | slotShowImage(); | 353 | slotShowImage(); |
331 | } | 354 | } |
332 | 355 | ||
356 | /* | ||
357 | * got thumb info add to the cache if items is visible | ||
358 | * we later need update after processing of slave is done | ||
359 | */ | ||
333 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | 360 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { |
334 | IconViewItem* item = g_stringInf[_path]; | 361 | IconViewItem* item = g_stringInf[_path]; |
335 | if (!item ) | 362 | if (!item ) |
336 | return; | 363 | return; |
@@ -341,8 +368,12 @@ void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | |||
341 | 368 | ||
342 | item->setText( str ); | 369 | item->setText( str ); |
343 | g_stringInf.remove( _path ); | 370 | g_stringInf.remove( _path ); |
344 | } | 371 | } |
372 | |||
373 | /* | ||
374 | * got thumbnail and see if it is visible so we need to update later | ||
375 | */ | ||
345 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | 376 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { |
346 | IconViewItem* item = g_stringPix[_path]; | 377 | IconViewItem* item = g_stringPix[_path]; |
347 | if (!item ) | 378 | if (!item ) |
348 | return; | 379 | return; |
@@ -358,12 +389,19 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | |||
358 | g_stringPix.remove( _path ); | 389 | g_stringPix.remove( _path ); |
359 | } | 390 | } |
360 | 391 | ||
361 | 392 | ||
393 | /* | ||
394 | * FIXME rename | ||
395 | */ | ||
362 | void PIconView::slotRename() { | 396 | void PIconView::slotRename() { |
363 | 397 | ||
364 | } | 398 | } |
365 | 399 | ||
400 | |||
401 | /* | ||
402 | * BEAM the current file | ||
403 | */ | ||
366 | void PIconView::slotBeam() { | 404 | void PIconView::slotBeam() { |
367 | bool isDir; | 405 | bool isDir; |
368 | QString pa = currentFileName( isDir ); | 406 | QString pa = currentFileName( isDir ); |
369 | if ( isDir && pa.isEmpty() ) | 407 | if ( isDir && pa.isEmpty() ) |
@@ -375,8 +413,11 @@ void PIconView::slotBeam() { | |||
375 | ir->send(pa, tr( "Image" ) ); | 413 | ir->send(pa, tr( "Image" ) ); |
376 | 414 | ||
377 | } | 415 | } |
378 | 416 | ||
417 | /* | ||
418 | * BEAM done clean up | ||
419 | */ | ||
379 | void PIconView::slotBeamDone( Ir* ir) { | 420 | void PIconView::slotBeamDone( Ir* ir) { |
380 | delete ir; | 421 | delete ir; |
381 | } | 422 | } |
382 | 423 | ||
@@ -392,9 +433,8 @@ void PIconView::slotEnd() { | |||
392 | } | 433 | } |
393 | 434 | ||
394 | void PIconView::slotShowImage() | 435 | void PIconView::slotShowImage() |
395 | { | 436 | { |
396 | qWarning( "SLotShowImage" ); | ||
397 | bool isDir = false; | 437 | bool isDir = false; |
398 | QString name = currentFileName(isDir); | 438 | QString name = currentFileName(isDir); |
399 | if (isDir) return; | 439 | if (isDir) return; |
400 | 440 | ||
@@ -403,9 +443,8 @@ void PIconView::slotShowImage() | |||
403 | void PIconView::slotShowImage( const QString& name) { | 443 | void PIconView::slotShowImage( const QString& name) { |
404 | emit sig_display( name ); | 444 | emit sig_display( name ); |
405 | } | 445 | } |
406 | void PIconView::slotImageInfo() { | 446 | void PIconView::slotImageInfo() { |
407 | qWarning( "SlotImageInfo" ); | ||
408 | bool isDir = false; | 447 | bool isDir = false; |
409 | QString name = currentFileName(isDir); | 448 | QString name = currentFileName(isDir); |
410 | if (isDir) return; | 449 | if (isDir) return; |
411 | 450 | ||