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.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 652acc9..7196aba 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -32,25 +32,24 @@
#include <qtimer.h>
#include <qstyle.h>
using Opie::Core::OKeyConfigItem;
/*
* The Icons, Request Cache and IconViewItem for the IconView
*/
namespace {
static QPixmap* _dirPix = 0;
static QPixmap* _unkPix = 0;
- static QPixmap* _picPix = 0;
static QPixmap* _emptyPix = 0;
class IconViewItem : public QIconViewItem {
public:
IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false);
QPixmap* pixmap()const;
QString path()const { return m_path; }
bool isDir()const { return m_isDir; }
void setText( const QString& );
bool textOnly()const{return m_textOnly;}
void setTextOnly(bool how){m_textOnly=how;}
/* just for starting recalc of item rect! */
virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE );
@@ -89,30 +88,30 @@ namespace {
IconViewItem::IconViewItem( QIconView* view,const QString& path,
const QString& name, bool isDir )
: QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
m_noInfo( false ),m_textOnly(false),m_Pixset(false)
{
if ( isDir && !_dirPix )
_dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
else if ( !isDir && !_unkPix )
_unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
}
- inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw)
+ inline void IconViewItem::setPixmap( const QPixmap & , bool, bool )
{
m_Pixset = true;
calcRect(text());
}
- inline void IconViewItem::setPixmap( const QPixmap & icon)
+ inline void IconViewItem::setPixmap( const QPixmap & )
{
m_Pixset = true;
calcRect(text());
}
inline QPixmap* IconViewItem::pixmap()const {
// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y()
// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX()
// << " " << iconView()->contentsY() << oendl;
if (textOnly()&&!m_isDir) {
if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
@@ -244,28 +243,25 @@ void PIconView::initKeys() {
Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
this, SLOT(slotImageInfo()) ) );
m_viewManager->load();
m_viewManager->handleWidget( m_view );
}
/*
* change one dir up
*/
void PIconView::slotDirUp()
{
- if (m_path.isEmpty()) return;
- QDir dir( m_path );
- dir.cdUp();
- slotChangeDir( dir.absPath() );
+ slotChangeDir( currentView()->dirLister()->dirUp( m_path ) );
}
/*
* change the dir
*/
void PIconView::slotChangeDir(const QString& path) {
if ( !currentView() )
return;
PDirLister *lister = currentView()->dirLister();
if (!lister )
return;
@@ -370,47 +366,54 @@ void PIconView::resetView() {
*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) {
+ setCurrentView(0l);
+ return;
+ }
+
if (map->find(str) == map->end()) {
owarn << "Key not found" << oendl;
- setCurrentView(0l); return;
+ 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 */
+ /* reload now with default Path*/
+ m_path = lis->defaultPath();
QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
}
void PIconView::slotReloadDir() {
slotChangeDir( m_path );
}
/*
* add files and folders
*/