summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc23
-rw-r--r--libopie/ofileselector.h4
2 files changed, 25 insertions, 2 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 14f035e..fbe69ed 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -702,96 +702,99 @@ void OFileSelector::initializeListView()
delete m_pseudoLayout;
m_boxToolbar = 0;
m_homeButton = 0;
m_docButton = 0;
m_location = 0;
m_up = 0;
m_pseudo = 0;
m_pseudoLayout = 0;
// time for the toolbar
m_pseudo = new QWidget(m_stack, "Pseudo Widget");
m_pseudoLayout = new QVBoxLayout(m_pseudo );
if(m_shTool ){
m_boxToolbar = new QHBoxLayout( );
m_boxToolbar->setAutoAdd( true );
m_location = new QComboBox(m_pseudo );
m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
m_up->setMinimumSize( QSize( 20, 20 ) );
m_up->setMaximumSize( QSize( 20, 20 ) );
connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
m_up->setFlat(TRUE);
m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
m_homeButton->setMinimumSize( QSize( 20, 20 ) );
m_homeButton->setMaximumSize( QSize( 20, 20 ) );
connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
m_homeButton->setFlat(TRUE);
m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
m_docButton->setMinimumSize( QSize( 20, 20 ) );
m_docButton->setMaximumSize( QSize( 20, 20 ) );
connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
m_docButton->setFlat(TRUE);
m_boxToolbar->addWidget(m_location );
m_boxToolbar->addWidget(m_up );
m_boxToolbar->addWidget(m_homeButton );
m_boxToolbar->addWidget(m_docButton );
m_pseudoLayout->addLayout(m_boxToolbar );
// lets fill the combobox
StorageInfo storage;
const QList<FileSystem> &fs = storage.fileSystems();
QListIterator<FileSystem> it ( fs );
for( ; it.current(); ++it ){
const QString disk = (*it)->name();
const QString path = (*it)->path();
m_location->insertItem(path+ "<-"+disk );
}
+ int count = m_location->count();
+ m_location->insertItem(m_currentDir );
+ m_location->setCurrentItem( count );
};
m_View = new QListView(m_pseudo, "Extended view" );
m_stack->addWidget( m_pseudo, EXTENDED );
m_stack->raiseWidget( EXTENDED );
m_pseudoLayout->addWidget(m_View );
QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
// set up the stuff
// Pixmap Name Date Size mime
//(m_View->header() )->hide();
//m_View->setRootIsDecorated(false);
m_View->addColumn(" ");
m_View->addColumn(tr("Name") );
m_View->addColumn(tr("Size") );
m_View->addColumn(tr("Date"), 60 );
m_View->addColumn(tr("Mime Type") );
QHeader *header = m_View->header();
header->hide();
m_View->setSorting(1 );
// connect now
connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
};
/* If a item is locked depends on the mode
if we're in OPEN !isReadable is locked
if we're in SAVE !isWriteable is locked
*/
void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
qWarning("Add Files" );
if( !m_files ){
qWarning("not mfiles" );
return;
}
MimeType type( info->filePath() );
QString name;
QString dir;
bool locked= false;
if(mime == "All" ){
@@ -957,103 +960,121 @@ void OFileSelector::slotContextMenu(QListViewItem *item)
QAction up;
up.setText("cd up");
up.addTo( &menu );
connect(&up, SIGNAL(activated() ),
this, SLOT(cdUP() ) );
QAction act;
OFileSelectorItem *sel = (OFileSelectorItem*)item;
if(sel->isDir() ){
act.setText( tr("Change Directory") );
act.addTo(&menu );
connect(&act, SIGNAL(activated() ),
this, SLOT(slotChangedDir() ) );
}else{
act.setText( tr("Open file" ) );
act.addTo( &menu );
connect(&act, SIGNAL(activated() ),
this, SLOT(slotOpen() ) );
}
QAction rescan;
rescan.setText( tr("Rescan") );
rescan.addTo( &menu );
connect(&rescan, SIGNAL(activated() ),
this, SLOT(slotRescan() ) );
QAction rename;
rename.setText( tr("Rename") );
rename.addTo( &menu );
connect(&rename, SIGNAL(activated() ),
this, SLOT(slotRename() ) );
menu.insertSeparator();
QAction delItem;
delItem.setText( tr("Delete") );
delItem.addTo(&menu );
connect(&delItem, SIGNAL(activated() ),
this, SLOT(slotDelete() ) );
menu.exec(QCursor::pos() );
}
}
bool OFileSelector::cd(const QString &str )
{
qWarning(" dir %s", str.latin1() );
QDir dir( str);
if(dir.exists() ){
m_currentDir = str;
reparse();
+ if(m_shTool ){
+ int count = m_location->count();
+ m_location->insertItem(str );
+ m_location->setCurrentItem( count );
+ }
return true;
}
return false;
}
void OFileSelector::slotChangedDir()
{
OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
if(sel->isDir() ){
QStringList str = QStringList::split("->", sel->text(1) );
cd( sel->directory() + "/" + str[0] );
}
}
void OFileSelector::slotOpen()
{
OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
if(!sel->isDir() ){
QStringList str = QStringList::split("->", sel->text(1) );
slotFileSelected( str[0] );
}
}
void OFileSelector::slotRescan()
{
reparse();
}
void OFileSelector::slotRename()
{
// rename inline
}
void OFileSelector::slotDelete()
{
qWarning("delete slot" );
OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
QStringList list = QStringList::split("->", sel->text(1) );
if( sel->isDir() ){
QString str = QString::fromLatin1("rm -rf ") + list[0];
::system(str.utf8().data() );
}else{
QFile::remove( list[0] );
}
m_View->takeItem( sel );
delete sel;
}
void OFileSelector::cdUP()
{
QDir dir( m_currentDir );
dir.cdUp();
if(dir.exists() ){
m_currentDir = dir.absPath();
reparse();
+ int count = m_location->count();
+ m_location->insertItem(m_currentDir );
+ m_location->setCurrentItem( count );
}
}
+void OFileSelector::slotHome()
+{
+ cd(QDir::homeDirPath() );
+}
+void OFileSelector::slotDoc()
+{
+ cd(QDir::homeDirPath() + "/Documents" );
+}
+void OFileSelector::slotNavigate()
+{
-
+}
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index b91c0ea..bf3cb48 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -222,54 +222,56 @@ class OFileSelector : public QWidget {
QPopupMenu *m_custom;
QLineEdit *m_edit;
QLabel *m_fnLabel;
bool m_shTool:1;
bool m_shPerm:1;
bool m_shLne:1;
bool m_shChooser:1;
bool m_shYesNo:1;
bool m_boCheckPerm:1;
bool m_autoMime:1;
bool m_case:1;
bool m_dir:1;
bool m_files:1;
bool m_showPopup:1;
// implementation todo
virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE );
virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE );
virtual void addSymlink(const QString &, QFileInfo *, bool = FALSE ){};
void delItems();
void initializeName();
void initializeYes();
void initializeChooser();
void initializeListView();
void initPics();
bool compliesMime(const QString &path, const QString &mime);
class OFileSelectorPrivate;
OFileSelectorPrivate *d;
static QMap<QString,QPixmap> *m_pixmaps;
private slots:
void slotFileSelected(const QString & ); // not really meant to be a slot
void slotFileBridgeSelected( const DocLnk & );
virtual void slotSelectionChanged();
virtual void slotCurrentChanged(QListViewItem* );
virtual void slotClicked( int, QListViewItem *item, const QPoint &, int);
virtual void slotRightButton(int, QListViewItem *, const QPoint &, int );
virtual void slotContextMenu( QListViewItem *item);
// listview crap see above
// PopupMenu crap
virtual void slotChangedDir();
virtual void slotOpen();
virtual void slotRescan();
virtual void slotRename();
virtual void slotDelete();
virtual void cdUP();
-
+ virtual void slotHome();
+ virtual void slotDoc();
+ virtual void slotNavigate( );
};
#endif