summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-01 01:48:02 (UTC)
committer zecke <zecke>2002-04-01 01:48:02 (UTC)
commit9a68bd2411e65eb6c51aead50a5b0b670174458d (patch) (unidiff)
tree05ab085d430edc2e821ea890da600774abc30f01
parent84850cd8811fc29aa39ecd2452884bf48ea27e92 (diff)
downloadopie-9a68bd2411e65eb6c51aead50a5b0b670174458d.zip
opie-9a68bd2411e65eb6c51aead50a5b0b670174458d.tar.gz
opie-9a68bd2411e65eb6c51aead50a5b0b670174458d.tar.bz2
Almost done ||
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
@@ -726,48 +726,51 @@ void OFileSelector::initializeListView()
726 m_homeButton->setMaximumSize( QSize( 20, 20 ) ); 726 m_homeButton->setMaximumSize( QSize( 20, 20 ) );
727 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 727 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
728 m_homeButton->setFlat(TRUE); 728 m_homeButton->setFlat(TRUE);
729 729
730 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); 730 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
731 m_docButton->setMinimumSize( QSize( 20, 20 ) ); 731 m_docButton->setMinimumSize( QSize( 20, 20 ) );
732 m_docButton->setMaximumSize( QSize( 20, 20 ) ); 732 m_docButton->setMaximumSize( QSize( 20, 20 ) );
733 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 733 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
734 m_docButton->setFlat(TRUE); 734 m_docButton->setFlat(TRUE);
735 735
736 m_boxToolbar->addWidget(m_location ); 736 m_boxToolbar->addWidget(m_location );
737 m_boxToolbar->addWidget(m_up ); 737 m_boxToolbar->addWidget(m_up );
738 m_boxToolbar->addWidget(m_homeButton ); 738 m_boxToolbar->addWidget(m_homeButton );
739 m_boxToolbar->addWidget(m_docButton ); 739 m_boxToolbar->addWidget(m_docButton );
740 m_pseudoLayout->addLayout(m_boxToolbar ); 740 m_pseudoLayout->addLayout(m_boxToolbar );
741 // lets fill the combobox 741 // lets fill the combobox
742 StorageInfo storage; 742 StorageInfo storage;
743 const QList<FileSystem> &fs = storage.fileSystems(); 743 const QList<FileSystem> &fs = storage.fileSystems();
744 QListIterator<FileSystem> it ( fs ); 744 QListIterator<FileSystem> it ( fs );
745 for( ; it.current(); ++it ){ 745 for( ; it.current(); ++it ){
746 const QString disk = (*it)->name(); 746 const QString disk = (*it)->name();
747 const QString path = (*it)->path(); 747 const QString path = (*it)->path();
748 m_location->insertItem(path+ "<-"+disk ); 748 m_location->insertItem(path+ "<-"+disk );
749 } 749 }
750 int count = m_location->count();
751 m_location->insertItem(m_currentDir );
752 m_location->setCurrentItem( count );
750 }; 753 };
751 m_View = new QListView(m_pseudo, "Extended view" ); 754 m_View = new QListView(m_pseudo, "Extended view" );
752 m_stack->addWidget( m_pseudo, EXTENDED ); 755 m_stack->addWidget( m_pseudo, EXTENDED );
753 m_stack->raiseWidget( EXTENDED ); 756 m_stack->raiseWidget( EXTENDED );
754 m_pseudoLayout->addWidget(m_View ); 757 m_pseudoLayout->addWidget(m_View );
755 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 758 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
756 // set up the stuff 759 // set up the stuff
757 // Pixmap Name Date Size mime 760 // Pixmap Name Date Size mime
758 //(m_View->header() )->hide(); 761 //(m_View->header() )->hide();
759 //m_View->setRootIsDecorated(false); 762 //m_View->setRootIsDecorated(false);
760 m_View->addColumn(" "); 763 m_View->addColumn(" ");
761 m_View->addColumn(tr("Name") ); 764 m_View->addColumn(tr("Name") );
762 m_View->addColumn(tr("Size") ); 765 m_View->addColumn(tr("Size") );
763 m_View->addColumn(tr("Date"), 60 ); 766 m_View->addColumn(tr("Date"), 60 );
764 m_View->addColumn(tr("Mime Type") ); 767 m_View->addColumn(tr("Mime Type") );
765 QHeader *header = m_View->header(); 768 QHeader *header = m_View->header();
766 header->hide(); 769 header->hide();
767 m_View->setSorting(1 ); 770 m_View->setSorting(1 );
768 // connect now 771 // connect now
769 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); 772 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
770 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 773 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
771 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 774 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
772 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 775 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
773 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 776 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
@@ -981,48 +984,53 @@ void OFileSelector::slotContextMenu(QListViewItem *item)
981 984
982 QAction rename; 985 QAction rename;
983 rename.setText( tr("Rename") ); 986 rename.setText( tr("Rename") );
984 rename.addTo( &menu ); 987 rename.addTo( &menu );
985 connect(&rename, SIGNAL(activated() ), 988 connect(&rename, SIGNAL(activated() ),
986 this, SLOT(slotRename() ) ); 989 this, SLOT(slotRename() ) );
987 990
988 menu.insertSeparator(); 991 menu.insertSeparator();
989 QAction delItem; 992 QAction delItem;
990 delItem.setText( tr("Delete") ); 993 delItem.setText( tr("Delete") );
991 delItem.addTo(&menu ); 994 delItem.addTo(&menu );
992 connect(&delItem, SIGNAL(activated() ), 995 connect(&delItem, SIGNAL(activated() ),
993 this, SLOT(slotDelete() ) ); 996 this, SLOT(slotDelete() ) );
994 997
995 menu.exec(QCursor::pos() ); 998 menu.exec(QCursor::pos() );
996 } 999 }
997} 1000}
998bool OFileSelector::cd(const QString &str ) 1001bool OFileSelector::cd(const QString &str )
999{ 1002{
1000 qWarning(" dir %s", str.latin1() ); 1003 qWarning(" dir %s", str.latin1() );
1001 QDir dir( str); 1004 QDir dir( str);
1002 if(dir.exists() ){ 1005 if(dir.exists() ){
1003 m_currentDir = str; 1006 m_currentDir = str;
1004 reparse(); 1007 reparse();
1008 if(m_shTool ){
1009 int count = m_location->count();
1010 m_location->insertItem(str );
1011 m_location->setCurrentItem( count );
1012 }
1005 return true; 1013 return true;
1006 } 1014 }
1007 return false; 1015 return false;
1008} 1016}
1009 1017
1010void OFileSelector::slotChangedDir() 1018void OFileSelector::slotChangedDir()
1011{ 1019{
1012 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1020 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1013 if(sel->isDir() ){ 1021 if(sel->isDir() ){
1014 QStringList str = QStringList::split("->", sel->text(1) ); 1022 QStringList str = QStringList::split("->", sel->text(1) );
1015 cd( sel->directory() + "/" + str[0] ); 1023 cd( sel->directory() + "/" + str[0] );
1016 } 1024 }
1017} 1025}
1018void OFileSelector::slotOpen() 1026void OFileSelector::slotOpen()
1019{ 1027{
1020 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1028 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1021 if(!sel->isDir() ){ 1029 if(!sel->isDir() ){
1022 QStringList str = QStringList::split("->", sel->text(1) ); 1030 QStringList str = QStringList::split("->", sel->text(1) );
1023 slotFileSelected( str[0] ); 1031 slotFileSelected( str[0] );
1024 } 1032 }
1025} 1033}
1026void OFileSelector::slotRescan() 1034void OFileSelector::slotRescan()
1027{ 1035{
1028 reparse(); 1036 reparse();
@@ -1032,28 +1040,41 @@ void OFileSelector::slotRename()
1032 // rename inline 1040 // rename inline
1033} 1041}
1034void OFileSelector::slotDelete() 1042void OFileSelector::slotDelete()
1035{ 1043{
1036 qWarning("delete slot" ); 1044 qWarning("delete slot" );
1037 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1045 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1038 QStringList list = QStringList::split("->", sel->text(1) ); 1046 QStringList list = QStringList::split("->", sel->text(1) );
1039 if( sel->isDir() ){ 1047 if( sel->isDir() ){
1040 QString str = QString::fromLatin1("rm -rf ") + list[0]; 1048 QString str = QString::fromLatin1("rm -rf ") + list[0];
1041 ::system(str.utf8().data() ); 1049 ::system(str.utf8().data() );
1042 }else{ 1050 }else{
1043 QFile::remove( list[0] ); 1051 QFile::remove( list[0] );
1044 } 1052 }
1045 m_View->takeItem( sel ); 1053 m_View->takeItem( sel );
1046 delete sel; 1054 delete sel;
1047} 1055}
1048 1056
1049void OFileSelector::cdUP() 1057void OFileSelector::cdUP()
1050{ 1058{
1051 QDir dir( m_currentDir ); 1059 QDir dir( m_currentDir );
1052 dir.cdUp(); 1060 dir.cdUp();
1053 if(dir.exists() ){ 1061 if(dir.exists() ){
1054 m_currentDir = dir.absPath(); 1062 m_currentDir = dir.absPath();
1055 reparse(); 1063 reparse();
1064 int count = m_location->count();
1065 m_location->insertItem(m_currentDir );
1066 m_location->setCurrentItem( count );
1056 } 1067 }
1057} 1068}
1069void OFileSelector::slotHome()
1070{
1071 cd(QDir::homeDirPath() );
1072}
1073void OFileSelector::slotDoc()
1074{
1075 cd(QDir::homeDirPath() + "/Documents" );
1076}
1077void OFileSelector::slotNavigate()
1078{
1058 1079
1059 1080}
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index b91c0ea..bf3cb48 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -246,30 +246,32 @@ class OFileSelector : public QWidget {
246 void initializeListView(); 246 void initializeListView();
247 void initPics(); 247 void initPics();
248 bool compliesMime(const QString &path, const QString &mime); 248 bool compliesMime(const QString &path, const QString &mime);
249 249
250 class OFileSelectorPrivate; 250 class OFileSelectorPrivate;
251 OFileSelectorPrivate *d; 251 OFileSelectorPrivate *d;
252 static QMap<QString,QPixmap> *m_pixmaps; 252 static QMap<QString,QPixmap> *m_pixmaps;
253 253
254private slots: 254private slots:
255 void slotFileSelected(const QString & ); // not really meant to be a slot 255 void slotFileSelected(const QString & ); // not really meant to be a slot
256 void slotFileBridgeSelected( const DocLnk & ); 256 void slotFileBridgeSelected( const DocLnk & );
257 virtual void slotSelectionChanged(); 257 virtual void slotSelectionChanged();
258 virtual void slotCurrentChanged(QListViewItem* ); 258 virtual void slotCurrentChanged(QListViewItem* );
259 virtual void slotClicked( int, QListViewItem *item, const QPoint &, int); 259 virtual void slotClicked( int, QListViewItem *item, const QPoint &, int);
260 virtual void slotRightButton(int, QListViewItem *, const QPoint &, int ); 260 virtual void slotRightButton(int, QListViewItem *, const QPoint &, int );
261 virtual void slotContextMenu( QListViewItem *item); 261 virtual void slotContextMenu( QListViewItem *item);
262 // listview crap see above 262 // listview crap see above
263 // PopupMenu crap 263 // PopupMenu crap
264 virtual void slotChangedDir(); 264 virtual void slotChangedDir();
265 virtual void slotOpen(); 265 virtual void slotOpen();
266 virtual void slotRescan(); 266 virtual void slotRescan();
267 virtual void slotRename(); 267 virtual void slotRename();
268 virtual void slotDelete(); 268 virtual void slotDelete();
269 virtual void cdUP(); 269 virtual void cdUP();
270 270 virtual void slotHome();
271 virtual void slotDoc();
272 virtual void slotNavigate( );
271}; 273};
272 274
273 275
274#endif 276#endif
275 277