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.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 7c8c88d..eafff1d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -132,48 +132,49 @@ namespace {
}
return m_pix ? m_pix : _unkPix;
}
}
inline void IconViewItem::setText( const QString& str ) {
QString text = QIconViewItem::text()+"\n"+str;
m_noInfo = true;
QIconViewItem::setText( text );
}
}
/*
* Set up the GUI.. initialize the slave set up gui
* and also load a dir
*/
PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
: QVBox( wid ), m_cfg( cfg ), m_updatet( false )
{
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
}
m_path = QDir::homeDirPath();
m_mode = 0;
+ m_internalReset = false;
QHBox *hbox = new QHBox( this );
QLabel* lbl = new QLabel( hbox );
lbl->setText( tr("View as" ) );
m_views = new QComboBox( hbox, "View As" );
m_view= new QIconView( this );
connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
this, SLOT(slotClicked(QIconViewItem*)) );
connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
this, SLOT(slotClicked(QIconViewItem*)) );
m_view->setArrangement( QIconView::LeftToRight );
m_mode = m_cfg->readNumEntry("ListViewMode", 1);
QString lastView = m_cfg->readEntry("LastView","");
if (m_mode < 1 || m_mode>3) m_mode = 1;
m_view->setItemTextPos( QIconView::Right );
calculateGrid();
@@ -342,94 +343,99 @@ void PIconView::slotTrash() {
if ( isDir && pa.isEmpty() )
return;
if (!QPEMessageBox::confirmDelete( this,
tr("Delete Image" ),
tr("the Image %1" ).arg(pa)))
return
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( it.key() );
}
void PIconView::resetView() {
+ m_internalReset = true;
slotViewChanged(m_views->currentItem());
+ m_internalReset = false;
}
/*
*swicth view reloadDir and connect signals
*/
void PIconView::slotViewChanged( int i) {
if (!m_views->count() ) {
setCurrentView( 0l);
return;
}
PDirView* cur = currentView();
if (cur) delete cur;
QString str = m_views->text(i);
ViewMap* map = viewMap();
if (!map) {
setCurrentView(0l);
return;
}
if (map->find(str) == map->end()) {
owarn << "Key not found" << oendl;
setCurrentView(0l);
return;
}
m_cfg->writeEntry("LastView",str);
m_cfg->write();
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()) );
- /* reload now with default Path*/
- m_path = lis->defaultPath();
+ /* reload now with default Path
+ * but only if it isn't a reset like from setupdlg
+ */
+ if (!m_internalReset)
+ m_path = lis->defaultPath();
QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
}
void PIconView::slotReloadDir() {
slotChangeDir( m_path );
}
/*
* add files and folders
*/
void PIconView::addFolders( const QStringList& lst) {
QStringList::ConstIterator it;
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;