summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
authorllornkcor <llornkcor>2002-07-20 03:00:42 (UTC)
committer llornkcor <llornkcor>2002-07-20 03:00:42 (UTC)
commitc42e3e2485c545beedd482115927bff7d1bf65a2 (patch) (side-by-side diff)
tree9b82c86631917d5ae66d9307c6b5e44237c1ecc9 /core/apps/textedit/textedit.cpp
parent8256eec0103a50f80905e71891904a4267754559 (diff)
downloadopie-c42e3e2485c545beedd482115927bff7d1bf65a2.zip
opie-c42e3e2485c545beedd482115927bff7d1bf65a2.tar.gz
opie-c42e3e2485c545beedd482115927bff7d1bf65a2.tar.bz2
added 'Advanced Features for prompting for .desktop files and permissions on saving
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index b276cbb..0af18da 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -333,30 +333,39 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
font->insertSeparator();
#endif
QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 );
connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) );
wa->setToggleAction(TRUE);
wa->addTo( font );
font->insertSeparator();
font->insertItem(tr("Font"), this, SLOT(changeFont()) );
font->insertSeparator();
+
nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 );
connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) );
nStart->setToggleAction(TRUE);
nStart->addTo( font );
+
+ nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 );
+ connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) );
+ nAdvanced->setToggleAction(TRUE);
+ nAdvanced->addTo( font );
+ if(cfg.readBoolEntry("AdvancedFeatures"))
+ nAdvanced->setOn(TRUE);
font->insertSeparator();
- font->insertItem(tr("About"), this, SLOT( doAbout()) );
+
+ font->insertItem(tr("About"), this, SLOT( doAbout()) );
mb->insertItem( tr( "File" ), file );
mb->insertItem( tr( "Edit" ), edit );
mb->insertItem( tr( "View" ), font );
searchBar = new QPEToolBar(this);
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
searchBar->setHorizontalStretchable( TRUE );
searchEdit = new QLineEdit( searchBar, "searchEdit" );
searchBar->setStretchableWidget( searchEdit );
@@ -614,25 +623,25 @@ void TextEdit::newFile( const DocLnk &f )
doc = new DocLnk(nf);
currentFileName = "Unnamed";
qDebug("newFile "+currentFileName);
updateCaption( currentFileName);
// editor->setEdited( FALSE);
}
void TextEdit::openFile( const QString &f )
{
qDebug("filename is "+ f);
QString filer;
// bFromDocView = TRUE;
- if(f.find(".desktop",0,TRUE) != -1) {
+ if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) {
switch ( QMessageBox::warning(this,tr("Text Editor"),
tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked 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 {
@@ -814,32 +823,32 @@ bool TextEdit::saveAs()
nf.setFile( fileNm);
doc = new DocLnk(nf);
// editor->setText(rt);
// qDebug("openFile doclnk "+currentFileName);
doc->setName( currentFileName);
updateCaption( currentFileName);
FileManager fm;
if ( !fm.saveFile( *doc, rt ) ) {
return false;
}
-// if( fileSaveDlg->filePermCheck->isChecked() ) {
+ if( useAdvancedFfeatures ) {
filePermissions *filePerm;
filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
filePerm->exec();
if( filePerm)
delete filePerm;
-// }
+ }
}
}
editor->setEdited(TRUE);
edited1=FALSE;
edited=TRUE;
if(caption().left(1)=="*")
setCaption(caption().right(caption().length()-1));
return true;
} //end saveAs
void TextEdit::clear()
@@ -957,12 +966,19 @@ void TextEdit::receive(const QCString&msg, const QByteArray&) {
qDebug("QCop "+msg);
if ( msg == "setDocument(QString)" ) {
qDebug("bugger all");
}
}
void TextEdit::doAbout() {
QMessageBox::about(0,"Text Edit","Text Edit is copyright\n"
"2000 Trolltech AS, and\n"
"2002 by L.J.Potter \nljp@llornkcor.com\n"
"and is licensed under the GPL");
}
+
+void TextEdit::doAdvanced(bool b) {
+ useAdvancedFeatures=b;
+ Config cfg("TextEdit");
+ cfg.setGroup("View");
+ cfg.writeEntry("AdvancedFeatures",b);
+}