author | llornkcor <llornkcor> | 2002-04-22 12:11:02 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-22 12:11:02 (UTC) |
commit | e79c930fb498f2bc3387da7133a57cd085244346 (patch) (unidiff) | |
tree | c98e0d3fb6c634bdb4404eebd11d7b532093d927 /noncore/unsupported/filebrowser/filebrowser.cpp | |
parent | f4c084cb531d8ee036514e4cfb2fcd0f5ffc6b8c (diff) | |
download | opie-e79c930fb498f2bc3387da7133a57cd085244346.zip opie-e79c930fb498f2bc3387da7133a57cd085244346.tar.gz opie-e79c930fb498f2bc3387da7133a57cd085244346.tar.bz2 |
fixed columns mixup
Diffstat (limited to 'noncore/unsupported/filebrowser/filebrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/filebrowser/filebrowser.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp index d9e2afa..1bb7984 100644 --- a/noncore/unsupported/filebrowser/filebrowser.cpp +++ b/noncore/unsupported/filebrowser/filebrowser.cpp | |||
@@ -59,16 +59,16 @@ FileItem::FileItem( QListView * parent, const QFileInfo & fi ) | |||
59 | setText( 0, fi.fileName() ); | 59 | setText( 0, fi.fileName() ); |
60 | setText( 1, sizeString( fi.size() ) + " " ); | 60 | setText( 1, sizeString( fi.size() ) + " " ); |
61 | setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) ); | 61 | setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) ); |
62 | 62 | ||
63 | MimeType mt(fi.filePath()); | 63 | MimeType mt(fi.filePath()); |
64 | 64 | ||
65 | if ( fi.isSymLink() ) | 65 | if ( fi.isSymLink() ) |
66 | setText( 3, "symlink" ); | 66 | setText( 3, "symlink" ); |
67 | else if( fi.isDir() ) | 67 | else if( fi.isDir() ) |
68 | setText( 3, "directory" ); | 68 | setText( 3, "directory" ); |
69 | else if( isLib() ) | 69 | else if( isLib() ) |
70 | setText( 3, "library" ); | 70 | setText( 3, "library" ); |
71 | else | 71 | else |
72 | setText( 3, mt.description() ); | 72 | setText( 3, mt.description() ); |
73 | 73 | ||
74 | QPixmap pm; | 74 | QPixmap pm; |
@@ -84,16 +84,16 @@ FileItem::FileItem( QListView * parent, const QFileInfo & fi ) | |||
84 | pm = Resource::loadPixmap( "library" ); | 84 | pm = Resource::loadPixmap( "library" ); |
85 | else | 85 | else |
86 | pm = mt.pixmap(); | 86 | pm = mt.pixmap(); |
87 | if ( pm.isNull() ) | 87 | if ( pm.isNull() ) |
88 | pm = Resource::loadPixmap("UnknownDocument-14"); | 88 | pm = Resource::loadPixmap("UnknownDocument-14"); |
89 | if( fi.isSymLink() ){ | 89 | if( fi.isSymLink() ){ |
90 | // overlay link image | 90 | // overlay link image |
91 | QPixmap lnk = Resource::loadPixmap( "filebrowser/symlink" ); | 91 | QPixmap lnk = Resource::loadPixmap( "filebrowser/symlink" ); |
92 | QPainter painter( &pm ); | 92 | QPainter painter( &pm ); |
93 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 93 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
94 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 94 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
95 | } | 95 | } |
96 | setPixmap(0,pm); | 96 | setPixmap(0,pm); |
97 | } | 97 | } |
98 | 98 | ||
99 | QString FileItem::sizeString( unsigned int s ) | 99 | QString FileItem::sizeString( unsigned int s ) |
@@ -172,25 +172,25 @@ bool FileItem::rename( const QString & name ) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | // | 174 | // |
175 | // FileView | 175 | // FileView |
176 | // | 176 | // |
177 | FileView::FileView( const QString & dir, QWidget * parent, | 177 | FileView::FileView( const QString & dir, QWidget * parent, |
178 | const char * name, | 178 | const char * name, |
179 | bool hidden, bool symlinks ) | 179 | bool hidden, bool symlinks ) |
180 | : QListView( parent, name ), | 180 | : QListView( parent, name ), |
181 | menuTimer( this ), | 181 | menuTimer( this ), |
182 | le( NULL ), | 182 | le( NULL ), |
183 | itemToRename( NULL ), | 183 | itemToRename( NULL ), |
184 | showHidden( hidden ), | 184 | showHidden( hidden ), |
185 | showSymlinks( symlinks), | 185 | showSymlinks( symlinks), |
186 | menuKeepsOpen( FALSE ) | 186 | menuKeepsOpen( FALSE ) |
187 | { | 187 | { |
188 | addColumn( "Name" ); | 188 | addColumn( "Name" ); |
189 | addColumn( "Date" ); | ||
190 | addColumn( "Size" ); | 189 | addColumn( "Size" ); |
190 | addColumn( "Date" ); | ||
191 | addColumn( "Type" ); | 191 | addColumn( "Type" ); |
192 | 192 | ||
193 | setMultiSelection( TRUE ); | 193 | setMultiSelection( TRUE ); |
194 | //header()->hide(); | 194 | //header()->hide(); |
195 | 195 | ||
196 | setColumnWidthMode( 0, Manual ); | 196 | setColumnWidthMode( 0, Manual ); |
@@ -233,16 +233,16 @@ void FileView::setDir( const QString & dir ) | |||
233 | dirHistory += currentDir; | 233 | dirHistory += currentDir; |
234 | generateDir( dir ); | 234 | generateDir( dir ); |
235 | } | 235 | } |
236 | 236 | ||
237 | void FileView::generateDir( const QString & dir ) | 237 | void FileView::generateDir( const QString & dir ) |
238 | { | 238 | { |
239 | if(menuKeepsOpen){ | 239 | if(menuKeepsOpen){ |
240 | cancelMenuTimer(); | 240 | cancelMenuTimer(); |
241 | } | 241 | } |
242 | QDir d( dir ); | 242 | QDir d( dir ); |
243 | 243 | ||
244 | if( d.exists() && !d.isReadable() ) return; | 244 | if( d.exists() && !d.isReadable() ) return; |
245 | 245 | ||
246 | currentDir = d.canonicalPath(); | 246 | currentDir = d.canonicalPath(); |
247 | 247 | ||
248 | if( !showHidden) | 248 | if( !showHidden) |
@@ -260,16 +260,16 @@ void FileView::generateDir( const QString & dir ) | |||
260 | clear(); | 260 | clear(); |
261 | while( (fi = it.current()) ){ | 261 | while( (fi = it.current()) ){ |
262 | if( (fi->fileName() == ".") || (fi->fileName() == "..") ){ | 262 | if( (fi->fileName() == ".") || (fi->fileName() == "..") ){ |
263 | ++it; | 263 | ++it; |
264 | continue; | 264 | continue; |
265 | } | 265 | } |
266 | if(!showSymlinks && fi->isSymLink()){ | 266 | if(!showSymlinks && fi->isSymLink()){ |
267 | ++it; | 267 | ++it; |
268 | continue; | 268 | continue; |
269 | } | 269 | } |
270 | (void) new FileItem( (QListView *) this, *fi ); | 270 | (void) new FileItem( (QListView *) this, *fi ); |
271 | ++it; | 271 | ++it; |
272 | } | 272 | } |
273 | emit dirChanged(); | 273 | emit dirChanged(); |
274 | } | 274 | } |
275 | 275 | ||
@@ -586,17 +586,17 @@ void FileView::itemClicked( QListViewItem * i) | |||
586 | setDir( t->getFilePath() ); | 586 | setDir( t->getFilePath() ); |
587 | } | 587 | } |
588 | } | 588 | } |
589 | 589 | ||
590 | void FileView::itemDblClicked( QListViewItem * i) | 590 | void FileView::itemDblClicked( QListViewItem * i) |
591 | { | 591 | { |
592 | if(menuKeepsOpen){ | 592 | if(menuKeepsOpen){ |
593 | cancelMenuTimer(); | 593 | cancelMenuTimer(); |
594 | } | 594 | } |
595 | 595 | ||
596 | FileItem * t = (FileItem *) i; | 596 | FileItem * t = (FileItem *) i; |
597 | 597 | ||
598 | if(t == NULL) return; | 598 | if(t == NULL) return; |
599 | if(t->launch() == -1){ | 599 | if(t->launch() == -1){ |
600 | QMessageBox::warning( this, tr( "Launch Application" ), | 600 | QMessageBox::warning( this, tr( "Launch Application" ), |
601 | tr( "Launch failed!" ), tr( "Ok" ) ); | 601 | tr( "Launch failed!" ), tr( "Ok" ) ); |
602 | } | 602 | } |
@@ -622,16 +622,16 @@ void FileView::contentsMousePressEvent( QMouseEvent * e ) | |||
622 | menuTimer.start( 750, TRUE ); | 622 | menuTimer.start( 750, TRUE ); |
623 | } | 623 | } |
624 | 624 | ||
625 | void FileView::contentsMouseReleaseEvent( QMouseEvent * e ) | 625 | void FileView::contentsMouseReleaseEvent( QMouseEvent * e ) |
626 | { | 626 | { |
627 | QListView::contentsMouseReleaseEvent( e ); | 627 | QListView::contentsMouseReleaseEvent( e ); |
628 | if(!menuKeepsOpen){ | 628 | if(!menuKeepsOpen){ |
629 | menuTimer.stop(); | 629 | menuTimer.stop(); |
630 | } | 630 | } |
631 | 631 | ||
632 | } | 632 | } |
633 | 633 | ||
634 | void FileView::cancelMenuTimer() | 634 | void FileView::cancelMenuTimer() |
635 | { | 635 | { |
636 | if( menuTimer.isActive() ) | 636 | if( menuTimer.isActive() ) |
637 | menuTimer.stop(); | 637 | menuTimer.stop(); |
@@ -701,23 +701,23 @@ void FileView::showFileMenu() | |||
701 | // | 701 | // |
702 | // FileBrowser | 702 | // FileBrowser |
703 | // | 703 | // |
704 | 704 | ||
705 | void FileView::setShowHidden(bool hidden) | 705 | void FileView::setShowHidden(bool hidden) |
706 | { | 706 | { |
707 | showHidden=hidden; | 707 | showHidden=hidden; |
708 | } | 708 | } |
709 | 709 | ||
710 | void FileView::setShowSymlinks(bool symlinks) | 710 | void FileView::setShowSymlinks(bool symlinks) |
711 | { | 711 | { |
712 | showSymlinks=symlinks; | 712 | showSymlinks=symlinks; |
713 | } | 713 | } |
714 | 714 | ||
715 | void FileView::setMenuKeepsOpen(bool keepOpen) | 715 | void FileView::setMenuKeepsOpen(bool keepOpen) |
716 | { | 716 | { |
717 | menuKeepsOpen=keepOpen; | 717 | menuKeepsOpen=keepOpen; |
718 | } | 718 | } |
719 | 719 | ||
720 | FileBrowser::FileBrowser( QWidget * parent, | 720 | FileBrowser::FileBrowser( QWidget * parent, |
721 | const char * name, WFlags f ) : | 721 | const char * name, WFlags f ) : |
722 | QMainWindow( parent, name, f ) | 722 | QMainWindow( parent, name, f ) |
723 | { | 723 | { |
@@ -733,25 +733,25 @@ FileBrowser::FileBrowser( const QString & dir, QWidget * parent, | |||
733 | 733 | ||
734 | void FileBrowser::init(const QString & dir) | 734 | void FileBrowser::init(const QString & dir) |
735 | { | 735 | { |
736 | setCaption( tr("File Manager") ); | 736 | setCaption( tr("File Manager") ); |
737 | setIcon( Resource::loadPixmap( "filebrowser_icon" ) ); | 737 | setIcon( Resource::loadPixmap( "filebrowser_icon" ) ); |
738 | 738 | ||
739 | Config cfg("Filebrowser"); | 739 | Config cfg("Filebrowser"); |
740 | cfg.setGroup("View"); | 740 | cfg.setGroup("View"); |
741 | bool showHidden=(cfg.readEntry("Hidden","FALSE") == "TRUE"); | 741 | bool showHidden=(cfg.readEntry("Hidden","FALSE") == "TRUE"); |
742 | bool showSymlinks=(cfg.readEntry("Symlinks","FALSE") == "TRUE"); | 742 | bool showSymlinks=(cfg.readEntry("Symlinks","FALSE") == "TRUE"); |
743 | 743 | ||
744 | cfg.setGroup("Menu"); | 744 | cfg.setGroup("Menu"); |
745 | bool menuKeepsOpen=(cfg.readEntry("KeepOpen", "FALSE") == "TRUE"); | 745 | bool menuKeepsOpen=(cfg.readEntry("KeepOpen", "FALSE") == "TRUE"); |
746 | 746 | ||
747 | 747 | ||
748 | fileView = new FileView( dir, this, 0, showHidden, showSymlinks ); | 748 | fileView = new FileView( dir, this, 0, showHidden, showSymlinks ); |
749 | fileView->setAllColumnsShowFocus( TRUE ); | 749 | fileView->setAllColumnsShowFocus( TRUE ); |
750 | fileView->setMenuKeepsOpen(menuKeepsOpen); | 750 | fileView->setMenuKeepsOpen(menuKeepsOpen); |
751 | 751 | ||
752 | setCentralWidget( fileView ); | 752 | setCentralWidget( fileView ); |
753 | setToolBarsMovable( FALSE ); | 753 | setToolBarsMovable( FALSE ); |
754 | 754 | ||
755 | QPEToolBar* toolBar = new QPEToolBar( this ); | 755 | QPEToolBar* toolBar = new QPEToolBar( this ); |
756 | toolBar->setHorizontalStretchable( TRUE ); | 756 | toolBar->setHorizontalStretchable( TRUE ); |
757 | 757 | ||
@@ -770,18 +770,18 @@ void FileBrowser::init(const QString & dir) | |||
770 | sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) ); | 770 | sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) ); |
771 | 771 | ||
772 | sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE ); | 772 | sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE ); |
773 | sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE ); | 773 | sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE ); |
774 | 774 | ||
775 | viewMenu = new QPopupMenu( this); | 775 | viewMenu = new QPopupMenu( this); |
776 | viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) ); | 776 | viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) ); |
777 | viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) ); | 777 | viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) ); |
778 | viewMenu->setItemChecked( viewMenu->idAt( 0 ), showHidden ); | 778 | viewMenu->setItemChecked( viewMenu->idAt( 0 ), showHidden ); |
779 | viewMenu->setItemChecked( viewMenu->idAt( 1 ), showSymlinks ); | 779 | viewMenu->setItemChecked( viewMenu->idAt( 1 ), showSymlinks ); |
780 | 780 | ||
781 | menuBar->insertItem( tr("View"), viewMenu ); | 781 | menuBar->insertItem( tr("View"), viewMenu ); |
782 | 782 | ||
783 | toolBar = new QPEToolBar( this ); | 783 | toolBar = new QPEToolBar( this ); |
784 | 784 | ||
785 | lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ), | 785 | lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ), |
786 | QString::null, 0, this, 0 ); | 786 | QString::null, 0, this, 0 ); |
787 | connect( lastAction, SIGNAL( activated() ), fileView, SLOT( lastDir() ) ); | 787 | connect( lastAction, SIGNAL( activated() ), fileView, SLOT( lastDir() ) ); |
@@ -953,31 +953,31 @@ void FileView::chPerm() { | |||
953 | updateDir(); | 953 | updateDir(); |
954 | } | 954 | } |
955 | } | 955 | } |
956 | 956 | ||
957 | void FileBrowser::updateShowHidden() | 957 | void FileBrowser::updateShowHidden() |
958 | { | 958 | { |
959 | bool valShowHidden=viewMenu->isItemChecked( viewMenu->idAt( 0 ) ); | 959 | bool valShowHidden=viewMenu->isItemChecked( viewMenu->idAt( 0 ) ); |
960 | valShowHidden=!valShowHidden; | 960 | valShowHidden=!valShowHidden; |
961 | viewMenu->setItemChecked( viewMenu->idAt( 0 ), valShowHidden ); | 961 | viewMenu->setItemChecked( viewMenu->idAt( 0 ), valShowHidden ); |
962 | fileView->setShowHidden(valShowHidden); | 962 | fileView->setShowHidden(valShowHidden); |
963 | 963 | ||
964 | Config cfg("Filebrowser"); | 964 | Config cfg("Filebrowser"); |
965 | cfg.setGroup("View"); | 965 | cfg.setGroup("View"); |
966 | cfg.writeEntry("Hidden",valShowHidden?"TRUE":"FALSE"); | 966 | cfg.writeEntry("Hidden",valShowHidden?"TRUE":"FALSE"); |
967 | 967 | ||
968 | fileView->updateDir(); | 968 | fileView->updateDir(); |
969 | } | 969 | } |
970 | 970 | ||
971 | void FileBrowser::updateShowSymlinks() | 971 | void FileBrowser::updateShowSymlinks() |
972 | { | 972 | { |
973 | bool valShowSymlinks=viewMenu->isItemChecked( viewMenu->idAt( 1 ) ); | 973 | bool valShowSymlinks=viewMenu->isItemChecked( viewMenu->idAt( 1 ) ); |
974 | valShowSymlinks=!valShowSymlinks; | 974 | valShowSymlinks=!valShowSymlinks; |
975 | viewMenu->setItemChecked( viewMenu->idAt( 1 ), valShowSymlinks ); | 975 | viewMenu->setItemChecked( viewMenu->idAt( 1 ), valShowSymlinks ); |
976 | fileView->setShowSymlinks(valShowSymlinks); | 976 | fileView->setShowSymlinks(valShowSymlinks); |
977 | 977 | ||
978 | Config cfg("Filebrowser"); | 978 | Config cfg("Filebrowser"); |
979 | cfg.setGroup("View"); | 979 | cfg.setGroup("View"); |
980 | cfg.writeEntry("Symlinks",valShowSymlinks?"TRUE":"FALSE"); | 980 | cfg.writeEntry("Symlinks",valShowSymlinks?"TRUE":"FALSE"); |
981 | 981 | ||
982 | fileView->updateDir(); | 982 | fileView->updateDir(); |
983 | } | 983 | } |