-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 | |||
@@ -46,131 +46,143 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
46 | 46 | ||
47 | 47 | ||
48 | dirLabel = new QLabel(this, "DirLabel"); | 48 | dirLabel = new QLabel(this, "DirLabel"); |
49 | dirLabel->setText(currentDir.canonicalPath()); | 49 | dirLabel->setText(currentDir.canonicalPath()); |
50 | dirLabel->setMinimumSize( QSize( 50, 15 ) ); | 50 | dirLabel->setMinimumSize( QSize( 50, 15 ) ); |
51 | dirLabel->setMaximumSize( QSize( 250, 15 ) ); | 51 | dirLabel->setMaximumSize( QSize( 250, 15 ) ); |
52 | layout->addWidget( dirLabel, 0, 0 ); | 52 | layout->addWidget( dirLabel, 0, 0 ); |
53 | 53 | ||
54 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 54 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
55 | docButton->setMinimumSize( QSize( 25, 25 ) ); | 55 | docButton->setMinimumSize( QSize( 25, 25 ) ); |
56 | docButton->setMaximumSize( QSize( 25, 25 ) ); | 56 | docButton->setMaximumSize( QSize( 25, 25 ) ); |
57 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 57 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
58 | docButton->setFlat(TRUE); | 58 | docButton->setFlat(TRUE); |
59 | layout->addWidget( docButton, 0, 1 ); | 59 | layout->addWidget( docButton, 0, 1 ); |
60 | 60 | ||
61 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 61 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
62 | homeButton->setMinimumSize( QSize( 25, 25 ) ); | 62 | homeButton->setMinimumSize( QSize( 25, 25 ) ); |
63 | homeButton->setMaximumSize( QSize( 25, 25 ) ); | 63 | homeButton->setMaximumSize( QSize( 25, 25 ) ); |
64 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 64 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
65 | homeButton->setFlat(TRUE); | 65 | homeButton->setFlat(TRUE); |
66 | layout->addWidget( homeButton, 0, 2 ); | 66 | layout->addWidget( homeButton, 0, 2 ); |
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 | ||
86 | fileSelector = new FileSelector( "text/*", FileStack, "fileselector" , FALSE, FALSE); //buggy | 87 | fileSelector = new FileSelector( "text/*", FileStack, "fileselector" , FALSE, FALSE); //buggy |
87 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); | 88 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); |
88 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 89 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
89 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 90 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); |
90 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 2 ); | 91 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 2 ); |
91 | 92 | ||
92 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); | 93 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); |
93 | SelectionCombo->setMinimumSize( QSize( 200, 25 ) ); | 94 | SelectionCombo->setMinimumSize( QSize( 200, 25 ) ); |
94 | SelectionCombo->insertItem( tr( "Documents" ) ); | 95 | SelectionCombo->insertItem( tr( "Documents" ) ); |
95 | SelectionCombo->insertItem( tr( "All files" ) ); | 96 | SelectionCombo->insertItem( tr( "All files" ) ); |
96 | SelectionCombo->insertItem( tr( "All files (incl. hidden)" ) ); | 97 | SelectionCombo->insertItem( tr( "All files (incl. hidden)" ) ); |
97 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 2 ); | 98 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 2 ); |
98 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), | 99 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), |
99 | this, SLOT( selectionChanged( const QString & ) ) ); | 100 | this, SLOT( selectionChanged( const QString & ) ) ); |
100 | 101 | ||
101 | currentDir.setPath(QDir::currentDirPath()); | 102 | currentDir.setPath(QDir::currentDirPath()); |
102 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); | 103 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); |
103 | 104 | ||
104 | populateList(); | 105 | populateList(); |
105 | move(0,15); | 106 | move(0,15); |
106 | } | 107 | } |
107 | 108 | ||
108 | fileBrowser::~fileBrowser() | 109 | fileBrowser::~fileBrowser() |
109 | { | 110 | { |
110 | } | 111 | } |
111 | 112 | ||
112 | void fileBrowser::setFileView( int selection ) | 113 | void fileBrowser::setFileView( int selection ) |
113 | { | 114 | { |
114 | SelectionCombo->setCurrentItem( selection ); | 115 | SelectionCombo->setCurrentItem( selection ); |
115 | selectionChanged( SelectionCombo->currentText() ); | 116 | selectionChanged( SelectionCombo->currentText() ); |
116 | } | 117 | } |
117 | 118 | ||
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; |
131 | while ( (fi=it.current()) ) { | 133 | while ( (fi=it.current()) ) { |
132 | 134 | ||
133 | if (fi->isSymLink() ){ | 135 | if (fi->isSymLink() ){ |
134 | QString symLink=fi->readLink(); | 136 | QString symLink=fi->readLink(); |
135 | // qDebug("Symlink detected "+symLink); | 137 | // qDebug("Symlink detected "+symLink); |
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 | ||
156 | void fileBrowser::upDir() | 168 | void fileBrowser::upDir() |
157 | { | 169 | { |
158 | // qDebug(currentDir.canonicalPath()); | 170 | // qDebug(currentDir.canonicalPath()); |
159 | } | 171 | } |
160 | 172 | ||
161 | // you may want to switch these 2 functions. I like single clicks | 173 | // you may want to switch these 2 functions. I like single clicks |
162 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 174 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
163 | { | 175 | { |
164 | QString strItem=selectedItem->text(0); | 176 | QString strItem=selectedItem->text(0); |
165 | QString strSize=selectedItem->text(1); | 177 | QString strSize=selectedItem->text(1); |
166 | // qDebug("strItem is "+strItem); | 178 | // qDebug("strItem is "+strItem); |
167 | strSize.stripWhiteSpace(); | 179 | strSize.stripWhiteSpace(); |
168 | // qDebug(strSize); | 180 | // qDebug(strSize); |
169 | 181 | ||
170 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 182 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
171 | // is symlink | 183 | // is symlink |
172 | QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); | 184 | QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); |
173 | // qDebug("strItem symlink is "+strItem2); | 185 | // qDebug("strItem symlink is "+strItem2); |
174 | if(QDir(strItem2).exists() ) { | 186 | if(QDir(strItem2).exists() ) { |
175 | currentDir.cd(strItem2, TRUE); | 187 | currentDir.cd(strItem2, TRUE); |
176 | populateList(); | 188 | populateList(); |
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 | |||
@@ -335,49 +335,48 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
335 | 335 | ||
336 | font->insertSeparator(); | 336 | font->insertSeparator(); |
337 | font->insertItem("Font", this, SLOT(changeFont()) ); | 337 | font->insertItem("Font", this, SLOT(changeFont()) ); |
338 | 338 | ||
339 | font->insertSeparator(); | 339 | font->insertSeparator(); |
340 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); | 340 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); |
341 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); | 341 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); |
342 | nStart->setToggleAction(TRUE); | 342 | nStart->setToggleAction(TRUE); |
343 | nStart->addTo( font ); | 343 | nStart->addTo( font ); |
344 | 344 | ||
345 | mb->insertItem( tr( "File" ), file ); | 345 | mb->insertItem( tr( "File" ), file ); |
346 | mb->insertItem( tr( "Edit" ), edit ); | 346 | mb->insertItem( tr( "Edit" ), edit ); |
347 | mb->insertItem( tr( "View" ), font ); | 347 | mb->insertItem( tr( "View" ), font ); |
348 | 348 | ||
349 | searchBar = new QPEToolBar(this); | 349 | searchBar = new QPEToolBar(this); |
350 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 350 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
351 | 351 | ||
352 | searchBar->setHorizontalStretchable( TRUE ); | 352 | searchBar->setHorizontalStretchable( TRUE ); |
353 | 353 | ||
354 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 354 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
355 | searchBar->setStretchableWidget( searchEdit ); | 355 | searchBar->setStretchableWidget( searchEdit ); |
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 ); |
363 | a->addTo( edit ); | 362 | a->addTo( edit ); |
364 | 363 | ||
365 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 364 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
366 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 365 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
367 | a->addTo( searchBar ); | 366 | a->addTo( searchBar ); |
368 | 367 | ||
369 | edit->insertSeparator(); | 368 | edit->insertSeparator(); |
370 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 369 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
371 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); | 370 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); |
372 | a->addTo( edit ); | 371 | a->addTo( edit ); |
373 | 372 | ||
374 | searchBar->hide(); | 373 | searchBar->hide(); |
375 | 374 | ||
376 | 375 | ||
377 | editor = new QpeEditor( this ); | 376 | editor = new QpeEditor( this ); |
378 | setCentralWidget( editor ); | 377 | setCentralWidget( editor ); |
379 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 378 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
380 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); | 379 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); |
381 | 380 | ||
382 | resize( 200, 300 ); | 381 | resize( 200, 300 ); |
383 | 382 | ||
@@ -398,49 +397,49 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
398 | wa->setOn(wrap); | 397 | wa->setOn(wrap); |
399 | updateCaption(); | 398 | updateCaption(); |
400 | 399 | ||
401 | cfg.setGroup("View"); | 400 | cfg.setGroup("View"); |
402 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { | 401 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { |
403 | nStart->setOn(TRUE); | 402 | nStart->setOn(TRUE); |
404 | fileNew(); | 403 | fileNew(); |
405 | } else { | 404 | } else { |
406 | fileOpen(); | 405 | fileOpen(); |
407 | } | 406 | } |
408 | viewSelection = cfg.readNumEntry( "FileView", 0 ); | 407 | viewSelection = cfg.readNumEntry( "FileView", 0 ); |
409 | } | 408 | } |
410 | 409 | ||
411 | TextEdit::~TextEdit() | 410 | TextEdit::~TextEdit() |
412 | { | 411 | { |
413 | // save(); | 412 | // save(); |
414 | 413 | ||
415 | Config cfg("TextEdit"); | 414 | Config cfg("TextEdit"); |
416 | cfg.setGroup("View"); | 415 | cfg.setGroup("View"); |
417 | QFont f = editor->font(); | 416 | QFont f = editor->font(); |
418 | cfg.writeEntry("FontSize",f.pointSize()); | 417 | cfg.writeEntry("FontSize",f.pointSize()); |
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() |
426 | { | 425 | { |
427 | setFontSize(editor->font().pointSize()+1,FALSE); | 426 | setFontSize(editor->font().pointSize()+1,FALSE); |
428 | } | 427 | } |
429 | 428 | ||
430 | void TextEdit::zoomOut() | 429 | void TextEdit::zoomOut() |
431 | { | 430 | { |
432 | setFontSize(editor->font().pointSize()-1,TRUE); | 431 | setFontSize(editor->font().pointSize()-1,TRUE); |
433 | } | 432 | } |
434 | 433 | ||
435 | 434 | ||
436 | void TextEdit::setFontSize(int sz, bool round_down_not_up) | 435 | void TextEdit::setFontSize(int sz, bool round_down_not_up) |
437 | { | 436 | { |
438 | int s=10; | 437 | int s=10; |
439 | for (int i=0; i<nfontsizes; i++) { | 438 | for (int i=0; i<nfontsizes; i++) { |
440 | if ( fontsize[i] == sz ) { | 439 | if ( fontsize[i] == sz ) { |
441 | s = sz; | 440 | s = sz; |
442 | break; | 441 | break; |
443 | } else if ( round_down_not_up ) { | 442 | } else if ( round_down_not_up ) { |
444 | if ( fontsize[i] < sz ) | 443 | if ( fontsize[i] < sz ) |
445 | s = fontsize[i]; | 444 | s = fontsize[i]; |
446 | } else { | 445 | } else { |
@@ -496,48 +495,52 @@ void TextEdit::fileOpen() | |||
496 | if( browseForFiles->exec() != -1 ) { | 495 | if( browseForFiles->exec() != -1 ) { |
497 | QString selFile= browseForFiles->selectedFileName; | 496 | QString selFile= browseForFiles->selectedFileName; |
498 | QStringList fileList=browseForFiles->fileList; | 497 | QStringList fileList=browseForFiles->fileList; |
499 | qDebug(selFile); | 498 | qDebug(selFile); |
500 | QStringList::ConstIterator f; | 499 | QStringList::ConstIterator f; |
501 | QString fileTemp; | 500 | QString fileTemp; |
502 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 501 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
503 | fileTemp = *f; | 502 | fileTemp = *f; |
504 | fileTemp.right( fileTemp.length()-5); | 503 | fileTemp.right( fileTemp.length()-5); |
505 | QString fileName = fileTemp; | 504 | QString fileName = fileTemp; |
506 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { | 505 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { |
507 | currentFileName = fileName; | 506 | currentFileName = fileName; |
508 | qDebug("please open "+currentFileName); | 507 | qDebug("please open "+currentFileName); |
509 | openFile(fileName ); | 508 | openFile(fileName ); |
510 | } | 509 | } |
511 | } | 510 | } |
512 | viewSelection = browseForFiles->SelectionCombo->currentItem(); | 511 | viewSelection = browseForFiles->SelectionCombo->currentItem(); |
513 | } | 512 | } |
514 | delete browseForFiles; | 513 | delete browseForFiles; |
515 | editor->setEdited( FALSE); | 514 | editor->setEdited( FALSE); |
516 | edited1=FALSE; | 515 | edited1=FALSE; |
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 |
523 | void TextEdit::slotFind() | 526 | void TextEdit::slotFind() |
524 | { | 527 | { |
525 | FindDialog frmFind( "Text Editor", this ); | 528 | FindDialog frmFind( "Text Editor", this ); |
526 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 529 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
527 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 530 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
528 | 531 | ||
529 | //case sensitive, backwards, [category] | 532 | //case sensitive, backwards, [category] |
530 | 533 | ||
531 | connect( editor, SIGNAL(notFound()), | 534 | connect( editor, SIGNAL(notFound()), |
532 | &frmFind, SLOT(slotNotFound()) ); | 535 | &frmFind, SLOT(slotNotFound()) ); |
533 | connect( editor, SIGNAL(searchWrapped()), | 536 | connect( editor, SIGNAL(searchWrapped()), |
534 | &frmFind, SLOT(slotWrapAround()) ); | 537 | &frmFind, SLOT(slotWrapAround()) ); |
535 | 538 | ||
536 | frmFind.exec(); | 539 | frmFind.exec(); |
537 | 540 | ||
538 | 541 | ||
539 | } | 542 | } |
540 | #endif | 543 | #endif |
541 | 544 | ||
542 | void TextEdit::fileRevert() | 545 | void TextEdit::fileRevert() |
543 | { | 546 | { |
@@ -550,60 +553,68 @@ void TextEdit::editCut() | |||
550 | #ifndef QT_NO_CLIPBOARD | 553 | #ifndef QT_NO_CLIPBOARD |
551 | editor->cut(); | 554 | editor->cut(); |
552 | #endif | 555 | #endif |
553 | } | 556 | } |
554 | 557 | ||
555 | void TextEdit::editCopy() | 558 | void TextEdit::editCopy() |
556 | { | 559 | { |
557 | #ifndef QT_NO_CLIPBOARD | 560 | #ifndef QT_NO_CLIPBOARD |
558 | editor->copy(); | 561 | editor->copy(); |
559 | #endif | 562 | #endif |
560 | } | 563 | } |
561 | 564 | ||
562 | void TextEdit::editPaste() | 565 | void TextEdit::editPaste() |
563 | { | 566 | { |
564 | #ifndef QT_NO_CLIPBOARD | 567 | #ifndef QT_NO_CLIPBOARD |
565 | editor->paste(); | 568 | editor->paste(); |
566 | #endif | 569 | #endif |
567 | } | 570 | } |
568 | 571 | ||
569 | void TextEdit::editFind() | 572 | void TextEdit::editFind() |
570 | { | 573 | { |
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() |
577 | { | 584 | { |
578 | editor->find( searchEdit->text(), FALSE, FALSE ); | 585 | editor->find( searchEdit->text(), FALSE, FALSE ); |
579 | 586 | ||
580 | } | 587 | } |
581 | 588 | ||
582 | void TextEdit::findClose() | 589 | 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() |
589 | { | 600 | { |
590 | editor->find( searchEdit->text(), FALSE, FALSE ); | 601 | editor->find( searchEdit->text(), FALSE, FALSE ); |
591 | } | 602 | } |
592 | 603 | ||
593 | void TextEdit::newFile( const DocLnk &f ) | 604 | void TextEdit::newFile( const DocLnk &f ) |
594 | { | 605 | { |
595 | DocLnk nf = f; | 606 | DocLnk nf = f; |
596 | nf.setType("text/plain"); | 607 | nf.setType("text/plain"); |
597 | clear(); | 608 | clear(); |
598 | setWState (WState_Reserved1 ); | 609 | setWState (WState_Reserved1 ); |
599 | editor->setFocus(); | 610 | editor->setFocus(); |
600 | doc = new DocLnk(nf); | 611 | doc = new DocLnk(nf); |
601 | qDebug("newFile "+currentFileName); | 612 | qDebug("newFile "+currentFileName); |
602 | updateCaption(currentFileName); | 613 | updateCaption(currentFileName); |
603 | } | 614 | } |
604 | 615 | ||
605 | void TextEdit::openFile( const QString &f ) | 616 | void TextEdit::openFile( const QString &f ) |
606 | { | 617 | { |
607 | 618 | ||
608 | bFromDocView = TRUE; | 619 | bFromDocView = TRUE; |
609 | DocLnk nf; | 620 | DocLnk nf; |