summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp149
1 files changed, 78 insertions, 71 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 5edf102..59a605a 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -194,3 +194,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
QPopupMenu *advancedMenu = new QPopupMenu(this);
-
+
font = new QPopupMenu( this );
@@ -249,3 +249,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
#endif
-
+
a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ),
@@ -276,3 +276,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
font->insertItem(tr("Advanced Features"), advancedMenu);
-
+
QAction *wa = new QAction( tr("Wrap lines"),
@@ -326,3 +326,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
nAutoSave->addTo( advancedMenu);
-
+
@@ -385,3 +385,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
editor-> setFont ( defaultFont );
-
// updateCaption();
@@ -396,3 +395,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
featureAutoSave = cfg.readBoolEntry( "autosave", false);
-
+
if(useSearchBar) searchBarAction->setOn(true);
@@ -407,3 +406,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
// }
-
+
bool wrap = cfg. readBoolEntry ( "Wrap", true );
@@ -415,3 +414,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
currentFileName=qApp->argv()[1];
-
+
QFileInfo fi(currentFileName);
@@ -448,3 +447,3 @@ void TextEdit::closeEvent(QCloseEvent *) {
- case 2:
+ case 2:
{
@@ -454,3 +453,3 @@ void TextEdit::closeEvent(QCloseEvent *) {
- case -1:
+ case -1:
break;
@@ -460,3 +459,3 @@ void TextEdit::closeEvent(QCloseEvent *) {
qApp->quit();
-
+
}
@@ -464,3 +463,3 @@ void TextEdit::closeEvent(QCloseEvent *) {
void TextEdit::cleanUp() {
-
+
Config cfg ( "TextEdit" );
@@ -472,3 +471,3 @@ void TextEdit::cleanUp() {
cfg.writeEntry ( "Italic", f. italic ( ));
-
+
cfg.setGroup ( "View" );
@@ -561,3 +560,3 @@ void TextEdit::setSearchBar(bool b) {
searchBar->hide();
- editor->setFocus();
+ editor->setFocus();
}
@@ -677,3 +676,3 @@ void TextEdit::openDotFile( const QString &f ) {
currentFileName=f;
-
+
qDebug("openFile dotfile " + currentFileName);
@@ -697,46 +696,54 @@ void TextEdit::openDotFile( const QString &f ) {
void TextEdit::openFile( const QString &f ) {
- qDebug("filename is "+ f);
- QString filer;
- QFileInfo fi( f);
+ qDebug("filename is "+ f);
+ QString filer;
+ QFileInfo fi( f);
// bFromDocView = true;
- if(f.find(".desktop",0,true) != -1 && !openDesktop ) {
- switch ( QMessageBox::warning(this,tr("Text Editor"),
- tr("Text Editor has detected<BR>you selected a <B>.desktop</B>
+ if(f.find(".desktop",0,true) != -1 && !openDesktop )
+ {
+ switch ( QMessageBox::warning(this,tr("Text Editor"),
+ tr("Text Editor has detected<BR>you selected a <B>.desktop</B>
file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"),
- tr(".desktop File"),tr("Linked Document"),0,1,1) ) {
- case 0:
- filer = f;
- break;
- case 1:
- DocLnk sf(f);
- filer = sf.file();
- break;
- }
- } else if(fi.baseName().left(1) == "") {
- currentFileName=f;
- openDotFile(currentFileName);
- } else {
- DocLnk sf(f);
- filer = sf.file();
- if(filer.right(1) == "/")
- filer = f;
-
- DocLnk nf;
- nf.setType("text/plain");
- nf.setFile(filer);
- currentFileName=filer;
+ tr(".desktop File"),tr("Linked Document"),0,1,1) )
+ {
+ case 0: //desktop
+ filer = f;
+ break;
+ case 1: //linked
+ DocLnk sf(f);
+ filer = sf.file();
+ break;
+ };
+ }
+ else if(fi.baseName().left(1) == "")
+ {
+ qDebug("opening dotfile");
+ currentFileName=f;
+ openDotFile(currentFileName);
+ return;
+ }
+ else
+ {
+ DocLnk sf(f);
+ filer = sf.file();
+ if(filer.right(1) == "/")
+ filer = f;
+ }
- nf.setName(fi.baseName());
- openFile(nf);
+ DocLnk nf;
+ nf.setType("text/plain");
+ nf.setFile(filer);
+ currentFileName=filer;
- qDebug("openFile string "+currentFileName);
+ nf.setName(fi.baseName());
+ openFile(nf);
- }
- showEditTools();
- // Show filename in caption
- QString name = filer;
- int sep = name.findRev( '/' );
- if ( sep > 0 )
- name = name.mid( sep+1 );
- updateCaption( name );
+ qDebug("openFile string "+currentFileName);
+
+ showEditTools();
+ // Show filename in caption
+ QString name = filer;
+ int sep = name.findRev( '/' );
+ if ( sep > 0 )
+ name = name.mid( sep+1 );
+ updateCaption( name );
}
@@ -820,3 +827,3 @@ bool TextEdit::save() {
}
-
+
}
@@ -843,3 +850,3 @@ bool TextEdit::saveAs() {
qDebug("saveAsFile " + currentFileName);
- // case of nothing to save...
+ // case of nothing to save...
// if ( !doc && !currentFileName.isEmpty()) {
@@ -857,3 +864,3 @@ bool TextEdit::saveAs() {
qDebug(currentFileName);
-
+
if( currentFileName.isEmpty()
@@ -914,3 +921,3 @@ bool TextEdit::saveAs() {
currentFileName=fi.fileName();
- if(doc)
+ if(doc)
// QString file = doc->file();
@@ -949,3 +956,3 @@ bool TextEdit::saveAs() {
setCaption(caption().right(caption().length()-1));
-
+
return true;
@@ -963,3 +970,3 @@ void TextEdit::clear() {
void TextEdit::updateCaption( const QString &name ) {
-
+
if ( name.isEmpty() )
@@ -1031,3 +1038,3 @@ void TextEdit::editDelete() {
break;
- case 1:
+ case 1:
// exit
@@ -1058,3 +1065,3 @@ void TextEdit::receive(const QCString&msg, const QByteArray &) {
qDebug("bugger all");
-
+
}
@@ -1074,3 +1081,3 @@ void TextEdit::doPrompt(bool b) {
cfg.setGroup ( "View" );
- cfg.writeEntry ( "PromptExit", b);
+ cfg.writeEntry ( "PromptExit", b);
}
@@ -1081,3 +1088,3 @@ void TextEdit::doDesktop(bool b) {
cfg.setGroup ( "View" );
- cfg.writeEntry ( "OpenDesktop", b);
+ cfg.writeEntry ( "OpenDesktop", b);
}
@@ -1088,3 +1095,3 @@ void TextEdit::doFilePerms(bool b) {
cfg.setGroup ( "View" );
- cfg.writeEntry ( "FilePermissions", b);
+ cfg.writeEntry ( "FilePermissions", b);
}
@@ -1114,3 +1121,3 @@ int TextEdit::savePrompt()
- case 1:
+ case 1:
{
@@ -1152,4 +1159,4 @@ void TextEdit::doTimer(bool b)
cfg.setGroup ( "View" );
- cfg.writeEntry ( "autosave", b);
- featureAutoSave = b;
+ cfg.writeEntry ( "autosave", b);
+ featureAutoSave = b;
nAutoSave->setOn(b);
@@ -1158,3 +1165,3 @@ void TextEdit::doTimer(bool b)
// qDebug("doTimer true");
- setTimer();
+ setTimer();
}
@@ -1180,3 +1187,3 @@ void TextEdit::gotoLine() {
gotoEdit = new QLineEdit( 0, "Goto line");
-
+
gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2));
@@ -1195,3 +1202,3 @@ void TextEdit::doGoto() {
}
-
+
bool ok;