summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/TODO4
-rw-r--r--libopie/ofileselector.cc187
-rw-r--r--libopie/ofileselector.h9
3 files changed, 183 insertions, 17 deletions
diff --git a/libopie/TODO b/libopie/TODO
index c1bf6d1..a4e1ada 100644
--- a/libopie/TODO
+++ b/libopie/TODO
@@ -8,3 +8,4 @@
8- OFileSelector 8- OFileSelector
9 - DocLnk when not in Document Mode 9 - DocLnk when not in Document Mode ( and vice versa )
10 - MultipleDocuments
10 - TreeView have a own OFileSelectorItem for this 11 - TreeView have a own OFileSelectorItem for this
@@ -14,2 +15,3 @@
14 - debug 15 - debug
16 - new Dirs created inside the listview
15 17
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index b583125..14f035e 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -51,2 +51,3 @@
51#include <qpe/resource.h> 51#include <qpe/resource.h>
52#include <qpe/storage.h>
52 53
@@ -118,2 +119,5 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString
118 119
120 m_pseudo = 0;
121 m_pseudoLayout = 0;
122
119 m_dir = true; 123 m_dir = true;
@@ -121,2 +125,3 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString
121 m_custom = 0; 125 m_custom = 0;
126 m_showPopup = true;
122 127
@@ -231,7 +236,15 @@ void OFileSelector::setToolbarVisible( bool show )
231 return; 236 return;
232 /* if( show ){ 237 if(!m_shTool ){
233 238 delete m_boxToolbar;
234 }else { 239 delete m_homeButton;
235 240 delete m_docButton;
236 }*/ 241 delete m_location;
242 delete m_up;
243 m_boxToolbar = 0;
244 m_homeButton = 0;
245 m_docButton = 0;
246 m_location = 0;
247 m_up = 0;
248 };
249 updateLay();// overkill fix it
237} 250}
@@ -420,3 +433,21 @@ void OFileSelector::reparse()
420 //dir.setFilter(-1 ); 433 //dir.setFilter(-1 );
421 dir.setSorting(QDir::Name | QDir::DirsFirst | QDir::Reversed | QDir::IgnoreCase ); 434 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
435 if( m_case )
436 sort = QDir::IgnoreCase;
437 dir.setSorting( sort );
438
439 int filter;
440 /* if( m_dir && !m_files)
441 filter |= QDir::Dirs;
442 else if( !m_dir && m_files )
443 filter |= QDir::Files;
444 else
445 filter |= QDir::All;
446 */
447 if( m_selector == EXTENDED_ALL )
448 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
449 else
450 filter = QDir::Files | QDir::Dirs | QDir::All;
451 dir.setFilter( filter );
452
422 const QFileInfoList *list = dir.entryInfoList(); 453 const QFileInfoList *list = dir.entryInfoList();
@@ -556,5 +587,21 @@ void OFileSelector::slotViewCheck(const QString &view ){
556 // check if we're the current widget and return 587 // check if we're the current widget and return
557 if( m_View != 0) // delete 0 shouldn't crash but it did :( 588 if( m_View != 0) { // delete 0 shouldn't crash but it did :(
558 delete m_View; 589 delete m_View;
590 delete m_boxToolbar;
591 delete m_homeButton;
592 delete m_docButton;
593 delete m_location;
594 delete m_up;
595 delete m_pseudo;
596 delete m_pseudoLayout;
597 }
559 m_View = 0; 598 m_View = 0;
599 m_boxToolbar = 0;
600 m_homeButton = 0;
601 m_docButton = 0;
602 m_location = 0;
603 m_up = 0;
604 m_pseudo = 0;
605 m_pseudoLayout = 0;
606
560 delete m_select; 607 delete m_select;
@@ -576,2 +623,18 @@ void OFileSelector::slotViewCheck(const QString &view ){
576 m_View = 0; 623 m_View = 0;
624
625 delete m_boxToolbar;
626 delete m_homeButton;
627 delete m_docButton;
628 delete m_location;
629 delete m_up;
630 delete m_pseudo;
631 delete m_pseudoLayout;
632 m_boxToolbar = 0;
633 m_homeButton = 0;
634 m_docButton = 0;
635 m_location = 0;
636 m_up = 0;
637 m_pseudo = 0;
638 m_pseudoLayout = 0;
639
577 m_selector = EXTENDED; 640 m_selector = EXTENDED;
@@ -587,2 +650,17 @@ void OFileSelector::slotViewCheck(const QString &view ){
587 m_View = 0; 650 m_View = 0;
651 delete m_boxToolbar;
652 delete m_homeButton;
653 delete m_docButton;
654 delete m_location;
655 delete m_up;
656 delete m_pseudo;
657 delete m_pseudoLayout;
658 m_boxToolbar = 0;
659 m_homeButton = 0;
660 m_docButton = 0;
661 m_location = 0;
662 m_up = 0;
663 m_pseudo = 0;
664 m_pseudoLayout = 0;
665
588 m_selector = EXTENDED_ALL; 666 m_selector = EXTENDED_ALL;
@@ -613,6 +691,65 @@ void OFileSelector::updateMimes() // lets check which mode is active
613void OFileSelector::initializeListView() 691void OFileSelector::initializeListView()
614{ 692{
615 m_View = new QListView(m_stack, "Extended view" ); 693 // just to make sure but clean it up better FIXME
616 m_stack->addWidget( m_View, EXTENDED ); 694 delete m_View;
695 m_View = 0;
696 delete m_boxToolbar;
697 delete m_homeButton;
698 delete m_docButton;
699 delete m_location;
700 delete m_up;
701 delete m_pseudo;
702 delete m_pseudoLayout;
703 m_boxToolbar = 0;
704 m_homeButton = 0;
705 m_docButton = 0;
706 m_location = 0;
707 m_up = 0;
708 m_pseudo = 0;
709 m_pseudoLayout = 0;
710 // time for the toolbar
711 m_pseudo = new QWidget(m_stack, "Pseudo Widget");
712 m_pseudoLayout = new QVBoxLayout(m_pseudo );
713 if(m_shTool ){
714 m_boxToolbar = new QHBoxLayout( );
715 m_boxToolbar->setAutoAdd( true );
716 m_location = new QComboBox(m_pseudo );
717
718 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
719 m_up->setMinimumSize( QSize( 20, 20 ) );
720 m_up->setMaximumSize( QSize( 20, 20 ) );
721 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
722 m_up->setFlat(TRUE);
723
724 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
725 m_homeButton->setMinimumSize( QSize( 20, 20 ) );
726 m_homeButton->setMaximumSize( QSize( 20, 20 ) );
727 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
728 m_homeButton->setFlat(TRUE);
729
730 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
731 m_docButton->setMinimumSize( QSize( 20, 20 ) );
732 m_docButton->setMaximumSize( QSize( 20, 20 ) );
733 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
734 m_docButton->setFlat(TRUE);
735
736 m_boxToolbar->addWidget(m_location );
737 m_boxToolbar->addWidget(m_up );
738 m_boxToolbar->addWidget(m_homeButton );
739 m_boxToolbar->addWidget(m_docButton );
740 m_pseudoLayout->addLayout(m_boxToolbar );
741 // lets fill the combobox
742 StorageInfo storage;
743 const QList<FileSystem> &fs = storage.fileSystems();
744 QListIterator<FileSystem> it ( fs );
745 for( ; it.current(); ++it ){
746 const QString disk = (*it)->name();
747 const QString path = (*it)->path();
748 m_location->insertItem(path+ "<-"+disk );
749 }
750 };
751 m_View = new QListView(m_pseudo, "Extended view" );
752 m_stack->addWidget( m_pseudo, EXTENDED );
617 m_stack->raiseWidget( EXTENDED ); 753 m_stack->raiseWidget( EXTENDED );
754 m_pseudoLayout->addWidget(m_View );
618 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 755 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
@@ -637,2 +774,4 @@ void OFileSelector::initializeListView()
637 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 774 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
775
776
638}; 777};
@@ -799,2 +938,5 @@ void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoin
799{ 938{
939 if (item == 0 )
940 return;
941
800 if( button != Qt::RightButton ) 942 if( button != Qt::RightButton )
@@ -807,2 +949,5 @@ void OFileSelector::slotContextMenu(QListViewItem *item)
807 qWarning("context menu" ); 949 qWarning("context menu" );
950 if( item ==0 || !m_showPopup )
951 return;
952
808 if( m_custom !=0){ 953 if( m_custom !=0){
@@ -811,2 +956,8 @@ void OFileSelector::slotContextMenu(QListViewItem *item)
811 QPopupMenu menu; 956 QPopupMenu menu;
957 QAction up;
958 up.setText("cd up");
959 up.addTo( &menu );
960 connect(&up, SIGNAL(activated() ),
961 this, SLOT(cdUP() ) );
962
812 QAction act; 963 QAction act;
@@ -827,3 +978,3 @@ void OFileSelector::slotContextMenu(QListViewItem *item)
827 rescan.addTo( &menu ); 978 rescan.addTo( &menu );
828 connect(&act, SIGNAL(activated() ), 979 connect(&rescan, SIGNAL(activated() ),
829 this, SLOT(slotRescan() ) ); 980 this, SLOT(slotRescan() ) );
@@ -833,3 +984,3 @@ void OFileSelector::slotContextMenu(QListViewItem *item)
833 rename.addTo( &menu ); 984 rename.addTo( &menu );
834 connect(&act, SIGNAL(activated() ), 985 connect(&rename, SIGNAL(activated() ),
835 this, SLOT(slotRename() ) ); 986 this, SLOT(slotRename() ) );
@@ -840,3 +991,3 @@ void OFileSelector::slotContextMenu(QListViewItem *item)
840 delItem.addTo(&menu ); 991 delItem.addTo(&menu );
841 connect(&act, SIGNAL(activated() ), 992 connect(&delItem, SIGNAL(activated() ),
842 this, SLOT(slotDelete() ) ); 993 this, SLOT(slotDelete() ) );
@@ -897,3 +1048,11 @@ void OFileSelector::slotDelete()
897 1048
898 1049void OFileSelector::cdUP()
1050{
1051 QDir dir( m_currentDir );
1052 dir.cdUp();
1053 if(dir.exists() ){
1054 m_currentDir = dir.absPath();
1055 reparse();
1056 }
1057}
899 1058
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index 458e552..b91c0ea 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -157,3 +157,4 @@ class OFileSelector : public QWidget {
157 157
158 158 bool showPopup()const { return m_showPopup; };
159 void setShowPopup( bool pop ) { m_showPopup = pop; };
159 void setPopupMenu( QPopupMenu * ); 160 void setPopupMenu( QPopupMenu * );
@@ -197,3 +198,3 @@ class OFileSelector : public QWidget {
197 private: 198 private:
198int m_mode, m_selector; 199 int m_mode, m_selector;
199 QComboBox *m_location, *m_mimeCheck, *m_viewCheck; 200 QComboBox *m_location, *m_mimeCheck, *m_viewCheck;
@@ -203,2 +204,4 @@ int m_mode, m_selector;
203 QCheckBox *m_checkPerm; 204 QCheckBox *m_checkPerm;
205 QWidget *m_pseudo;
206 QVBoxLayout *m_pseudoLayout;
204 207
@@ -232,2 +235,3 @@ int m_mode, m_selector;
232 bool m_files:1; 235 bool m_files:1;
236 bool m_showPopup:1;
233 237
@@ -264,2 +268,3 @@ private slots:
264 virtual void slotDelete(); 268 virtual void slotDelete();
269 virtual void cdUP();
265 270