summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 660c4fa..087db30 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -336,44 +336,50 @@ void PIconView::slotTrash() {
currentView()->dirLister()->deleteImage( pa );
delete m_view->currentItem();
}
/*
* see what views are available
*/
void PIconView::loadViews() {
ViewMap::Iterator it;
ViewMap* map = viewMap();
for ( it = map->begin(); it != map->end(); ++it )
- m_views->insertItem( QObject::tr(it.key() ) );
+ m_views->insertItem( it.key() );
}
void PIconView::resetView() {
slotViewChanged(m_views->currentItem());
}
/*
*swicth view reloadDir and connect signals
*/
void PIconView::slotViewChanged( int i) {
if (!m_views->count() ) {
setCurrentView( 0l);
return;
}
PDirView* cur = currentView();
- delete cur;
+ if (cur) delete cur;
QString str = m_views->text(i);
- cur = (*(*viewMap())[str])(*m_cfg);
+ ViewMap* map = viewMap();
+ if (!map) {setCurrentView(0l); return;}
+ if (map->find(str) == map->end()) {
+ owarn << "Key not found" << oendl;
+ setCurrentView(0l); return;
+ }
+ cur = (*(*map)[str])(*m_cfg);
setCurrentView( cur );
/* connect to the signals of the lister */
PDirLister* lis = cur->dirLister();
connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
this, SLOT( slotThumbInfo(const QString&, const QString&)));
connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
connect(lis, SIGNAL(sig_start()),
this, SLOT(slotStart()));
connect(lis, SIGNAL(sig_end()) ,
this, SLOT(slotEnd()) );
@@ -397,27 +403,31 @@ void PIconView::addFolders( const QStringList& lst) {
IconViewItem * _iv;
for(it=lst.begin(); it != lst.end(); ++it ) {
_iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
if (m_mode==3) _iv->setTextOnly(true);
}
}
void PIconView::addFiles( const QStringList& lst) {
QStringList::ConstIterator it;
IconViewItem * _iv;
QPixmap*m_pix = 0;
+ QString pre = "";
+ if (!m_path.isEmpty()) {
+ pre = m_path+"/";
+ }
for (it=lst.begin(); it!= lst.end(); ++it ) {
- m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 );
- _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
+ m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 );
+ _iv = new IconViewItem( m_view, pre+(*it), (*it) );
if (m_mode==3) {
_iv->setTextOnly(true);
_iv->setPixmap(QPixmap());
} else {
if (m_pix) _iv->setPixmap(*m_pix);
}
}
}
/*
* user clicked on the item. Change dir or view
@@ -534,62 +544,63 @@ void PIconView::slotShowPrev()
if (name.isEmpty()) return;
if (isDir) return;
/* if we got a name we have a prev item */
m_view->setCurrentItem(m_view->currentItem()->prevItem());
slotShowImage(name);
}
void PIconView::slotShowImage()
{
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
-
slotShowImage( name );
}
void PIconView::slotShowImage( const QString& name) {
- emit sig_display( name );
+ PDirLister *lister = currentView()->dirLister();
+ QString r_name = lister->nameToFname(name);
+ emit sig_display( r_name );
}
void PIconView::slotImageInfo() {
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
slotImageInfo( name );
}
void PIconView::slotImageInfo( const QString& name) {
- emit sig_showInfo( name );
+ PDirLister *lister = currentView()->dirLister();
+ QString r_name = lister->nameToFname(name);
+ emit sig_showInfo(r_name );
}
void PIconView::slotChangeMode( int mode ) {
if ( mode >= 1 && mode <= 3 )
m_mode = mode;
m_cfg->writeEntry("ListViewMode", m_mode);
calculateGrid();
slotReloadDir();
}
void PIconView::resizeEvent( QResizeEvent* re ) {
QVBox::resizeEvent( re );
calculateGrid();
}
void PIconView::calculateGrid() {
- odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl;
- odebug << "Size of view: " << m_view->size() << oendl;
int dw = QApplication::desktop()->width();
int viewerWidth = dw-style().scrollBarExtent().width();
QIconView::ItemTextPos pos;
switch( m_mode ) {
case 2:
pos = QIconView::Bottom;
break;
case 3:
case 1:
default:
pos = QIconView::Right;