-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 30 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 15 |
2 files changed, 34 insertions, 11 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 92c15cb..8cb7c38 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -67,19 +67,20 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
67 | 67 | ||
68 | FileStack = new QWidgetStack( this ); | 68 | FileStack = new QWidgetStack( this ); |
69 | 69 | ||
70 | ListView = new QListView( this, "ListView" ); | 70 | ListView = new QListView( this, "ListView" ); |
71 | ListView->setMinimumSize( QSize( 100, 25 ) ); | 71 | ListView->setMinimumSize( QSize( 100, 25 ) ); |
72 | ListView->addColumn( tr( "Name" ) ); | 72 | ListView->addColumn( tr( "Name" ) ); |
73 | ListView->setColumnWidth(0,140); | 73 | ListView->setColumnWidth(0,120); |
74 | ListView->setSorting( 2, FALSE); | 74 | ListView->setSorting( 2, FALSE); |
75 | ListView->addColumn( tr( "Size" ) ); | 75 | ListView->addColumn( tr( "Size" ) ); |
76 | ListView->setColumnWidth(1,59); | 76 | ListView->setColumnWidth(1,-1); |
77 | ListView->addColumn( "Date",-1); | ||
77 | // ListView->addColumn( tr( "" ) ); | 78 | // ListView->addColumn( tr( "" ) ); |
78 | ListView->setColumnWidthMode(0,QListView::Manual); | 79 | ListView->setColumnWidthMode(0,QListView::Manual); |
79 | ListView->setColumnAlignment(1,QListView::AlignRight); | 80 | ListView->setColumnAlignment(1,QListView::AlignRight); |
80 | // ListView->setMultiSelection(true); | 81 | ListView->setColumnAlignment(2,QListView::AlignRight); |
81 | // ListView->setSelectionMode(QListView::Extended); | ||
82 | ListView->setAllColumnsShowFocus( TRUE ); | 82 | ListView->setAllColumnsShowFocus( TRUE ); |
83 | |||
83 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 84 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
84 | FileStack->addWidget( ListView, get_unique_id() ); | 85 | FileStack->addWidget( ListView, get_unique_id() ); |
85 | 86 | ||
@@ -118,13 +119,14 @@ void fileBrowser::setFileView( int selection ) | |||
118 | void fileBrowser::populateList() | 119 | void fileBrowser::populateList() |
119 | { | 120 | { |
120 | ListView->clear(); | 121 | ListView->clear(); |
122 | bool isDir=FALSE; | ||
121 | //qDebug(currentDir.canonicalPath()); | 123 | //qDebug(currentDir.canonicalPath()); |
122 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 124 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
123 | currentDir.setMatchAllDirs(TRUE); | 125 | currentDir.setMatchAllDirs(TRUE); |
124 | 126 | ||
125 | currentDir.setNameFilter(filterStr); | 127 | currentDir.setNameFilter(filterStr); |
126 | // currentDir.setNameFilter("*.txt;*.etx"); | 128 | // currentDir.setNameFilter("*.txt;*.etx"); |
127 | QString fileL, fileS; | 129 | QString fileL, fileS, fileDate; |
128 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 130 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
129 | QFileInfoListIterator it(*list); | 131 | QFileInfoListIterator it(*list); |
130 | QFileInfo *fi; | 132 | QFileInfo *fi; |
@@ -136,20 +138,30 @@ void fileBrowser::populateList() | |||
136 | QFileInfo sym( symLink); | 138 | QFileInfo sym( symLink); |
137 | fileS.sprintf( "%10li", sym.size() ); | 139 | fileS.sprintf( "%10li", sym.size() ); |
138 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 140 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
139 | 141 | fileDate = sym.lastModified().toString(); | |
140 | } else { | 142 | } else { |
141 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 143 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
142 | fileS.sprintf( "%10li", fi->size() ); | 144 | fileS.sprintf( "%10li", fi->size() ); |
143 | fileL.sprintf( "%s",fi->fileName().data() ); | 145 | fileL.sprintf( "%s",fi->fileName().data() ); |
146 | fileDate= fi->lastModified().toString(); | ||
144 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 147 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
145 | fileL+="/"; | 148 | fileL+="/"; |
149 | isDir=TRUE; | ||
146 | // qDebug( fileL); | 150 | // qDebug( fileL); |
147 | } | 151 | } |
148 | } | 152 | } |
149 | item= new QListViewItem( ListView,fileL,fileS ); | 153 | if(fileL !="./") { |
154 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | ||
155 | if(isDir || fileL.find("/",0,TRUE) != -1) | ||
156 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | ||
157 | else | ||
158 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | ||
159 | } | ||
160 | isDir=FALSE; | ||
150 | ++it; | 161 | ++it; |
151 | } | 162 | } |
152 | ListView->setSorting( 2, FALSE); | 163 | // ListView->setSorting( 2, FALSE); |
164 | ListView->setSorting( 3, FALSE); | ||
153 | dirLabel->setText(currentDir.canonicalPath()); | 165 | dirLabel->setText(currentDir.canonicalPath()); |
154 | } | 166 | } |
155 | 167 | ||
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 68ee1b4..d3f5fb4 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -356,7 +356,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
356 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 356 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
357 | this, SLOT( search() ) ); | 357 | this, SLOT( search() ) ); |
358 | 358 | ||
359 | |||
360 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 359 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); |
361 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 360 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
362 | a->addTo( searchBar ); | 361 | a->addTo( searchBar ); |
@@ -419,7 +418,7 @@ TextEdit::~TextEdit() | |||
419 | cfg.writeEntry("Bold",f.bold()); | 418 | cfg.writeEntry("Bold",f.bold()); |
420 | cfg.writeEntry("Italic",f.italic()); | 419 | cfg.writeEntry("Italic",f.italic()); |
421 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); | 420 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); |
422 | cfg.writeEntry( "FileView", viewSelection ); | 421 | cfg.writeEntry( "FileView", viewSelection ); |
423 | } | 422 | } |
424 | 423 | ||
425 | void TextEdit::zoomIn() | 424 | void TextEdit::zoomIn() |
@@ -517,6 +516,10 @@ void TextEdit::fileOpen() | |||
517 | edited=FALSE; | 516 | edited=FALSE; |
518 | if(caption().left(1)=="*") | 517 | if(caption().left(1)=="*") |
519 | setCaption(caption().right(caption().length()-1)); | 518 | setCaption(caption().right(caption().length()-1)); |
519 | Config cfg("TextEdit"); | ||
520 | cfg.setGroup("View"); | ||
521 | if(cfg.readEntry("SearchBar","Closed") != "Opened") | ||
522 | searchBar->hide(); | ||
520 | } | 523 | } |
521 | 524 | ||
522 | #if 0 | 525 | #if 0 |
@@ -571,6 +574,10 @@ void TextEdit::editFind() | |||
571 | searchBar->show(); | 574 | searchBar->show(); |
572 | searchVisible = TRUE; | 575 | searchVisible = TRUE; |
573 | searchEdit->setFocus(); | 576 | searchEdit->setFocus(); |
577 | Config cfg("TextEdit"); | ||
578 | cfg.setGroup("View"); | ||
579 | cfg.writeEntry("SearchBar","Opened"); | ||
580 | |||
574 | } | 581 | } |
575 | 582 | ||
576 | void TextEdit::findNext() | 583 | void TextEdit::findNext() |
@@ -583,6 +590,10 @@ void TextEdit::findClose() | |||
583 | { | 590 | { |
584 | searchVisible = FALSE; | 591 | searchVisible = FALSE; |
585 | searchBar->hide(); | 592 | searchBar->hide(); |
593 | Config cfg("TextEdit"); | ||
594 | cfg.setGroup("View"); | ||
595 | cfg.writeEntry("SearchBar","Closed"); | ||
596 | cfg.write(); | ||
586 | } | 597 | } |
587 | 598 | ||
588 | void TextEdit::search() | 599 | void TextEdit::search() |