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) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp58
1 files changed, 37 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 948477c..138e661 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -187,73 +187,60 @@ namespace {
*/
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_iconsize = 32;
m_internalReset = false;
m_customWidget = 0;
+ m_setDocCalled = false;
m_hbox = new QHBox( this );
QLabel* lbl = new QLabel( m_hbox );
lbl->setText( tr("View as" ) );
m_views = new QComboBox( m_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 );
if (m_mode >1) {
m_view->setResizeMode(QIconView::Adjust);
} else {
m_view->setResizeMode(QIconView::Fixed);
}
m_iconsize = m_cfg->readNumEntry("iconsize", 32);
if (m_iconsize<12)m_iconsize = 12;
if (m_iconsize>64)m_iconsize = 64;
calculateGrid();
-
initKeys();
-
loadViews();
- int cc=0;
- for (; cc<m_views->count();++cc) {
- if (m_views->text(cc)==lastView) {
- break;
- }
- }
- if (cc<m_views->count()) {
- m_views->setCurrentItem(cc);
- slotViewChanged(cc);
- } else {
- slotViewChanged(m_views->currentItem());
}
- connect( m_views, SIGNAL(activated(int)),
- this, SLOT(slotViewChanged(int)) );
+
+void PIconView::setDoccalled(bool how)
+{
+ m_setDocCalled = how;
}
/*
* Unref the slave and save the keyboard manager
*/
PIconView::~PIconView() {
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
}
m_viewManager->save();
delete m_viewManager;
}
@@ -432,24 +419,48 @@ void PIconView::resetView() {
delete _cpyPix;
_cpyPix = 0;
}
calculateGrid();
}
} else {
m_iconsize = 64;
}
slotViewChanged(m_views->currentItem());
m_internalReset = false;
}
+void PIconView::polish()
+{
+ odebug << "===\n"
+ << "PIconView::polish()\n"
+ << "====" << oendl;
+ QVBox::polish();
+
+ QString lastView = m_cfg->readEntry("LastView","");
+ int cc=0;
+ for (; cc<m_views->count();++cc) {
+ if (m_views->text(cc)==lastView) {
+ break;
+ }
+ }
+ if (cc<m_views->count()) {
+ m_views->setCurrentItem(cc);
+ slotViewChanged(cc);
+ } else {
+ slotViewChanged(m_views->currentItem());
+ }
+ connect( m_views, SIGNAL(activated(int)),
+ this, SLOT(slotViewChanged(int)) );
+}
+
/*
*swicth view reloadDir and connect signals
*/
void PIconView::slotViewChanged( int i) {
if (!m_views->count() ) {
setCurrentView( 0l);
return;
}
if (m_customWidget) {
delete m_customWidget;
m_customWidget = 0;
@@ -520,33 +531,38 @@ void PIconView::addFolders( const QStringList& lst) {
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+"/";
}
+ QString s = "";
+ int pos;
for (it=lst.begin(); it!= lst.end(); ++it ) {
+ s = (*it);
+ pos = s.find(char(0));
m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
+ if (pos>-1) {
+ _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize );
+ } else {
_iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
+ }
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
*/
void PIconView::slotClicked(QIconViewItem* _it) {
if(!_it )