summaryrefslogtreecommitdiff
authorbipolar <bipolar>2002-03-06 00:58:32 (UTC)
committer bipolar <bipolar>2002-03-06 00:58:32 (UTC)
commit406bed0f501ea131ba31dbdecdde8c1fe8b15806 (patch) (unidiff)
tree11f375b25df3534e7d8ecd4120ee2df53a9791d3
parentfcb139a744cfe6c9521962595f15cd8369251c56 (diff)
downloadopie-406bed0f501ea131ba31dbdecdde8c1fe8b15806.zip
opie-406bed0f501ea131ba31dbdecdde8c1fe8b15806.tar.gz
opie-406bed0f501ea131ba31dbdecdde8c1fe8b15806.tar.bz2
ljp: fixed setDocument opening the .desktop file and not the file it points too
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index f138572..0f19da9 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -787,100 +787,103 @@ bool TextEdit::saveAs()
787 787
788 FileManager fm; 788 FileManager fm;
789 if ( !fm.saveFile( *doc, rt ) ) { 789 if ( !fm.saveFile( *doc, rt ) ) {
790 return false; 790 return false;
791 } 791 }
792 if( fileSaveDlg->filePermCheck->isChecked() ) { 792 if( fileSaveDlg->filePermCheck->isChecked() ) {
793 filePermissions *filePerm; 793 filePermissions *filePerm;
794 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); 794 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm);
795 filePerm->exec(); 795 filePerm->exec();
796 editor->setEdited( false ); 796 editor->setEdited( false );
797 if( filePerm) 797 if( filePerm)
798 delete filePerm; 798 delete filePerm;
799 } 799 }
800 } 800 }
801 } 801 }
802 802
803 if(fileSaveDlg) 803 if(fileSaveDlg)
804 delete fileSaveDlg; 804 delete fileSaveDlg;
805 return true; 805 return true;
806} 806}
807 807
808void TextEdit::clear() 808void TextEdit::clear()
809{ 809{
810 delete doc; 810 delete doc;
811 doc = 0; 811 doc = 0;
812 editor->clear(); 812 editor->clear();
813} 813}
814 814
815void TextEdit::updateCaption( const QString &name ) 815void TextEdit::updateCaption( const QString &name )
816{ 816{
817 if ( !doc ) 817 if ( !doc )
818 setCaption( tr("Text Editor") ); 818 setCaption( tr("Text Editor") );
819 else { 819 else {
820 QString s = name; 820 QString s = name;
821 if ( s.isNull() ) 821 if ( s.isNull() )
822 s = doc->name(); 822 s = doc->name();
823 if ( s.isEmpty() ) { 823 if ( s.isEmpty() ) {
824 s = tr( "Unnamed" ); 824 s = tr( "Unnamed" );
825 currentFileName=s; 825 currentFileName=s;
826 } 826 }
827 827
828 setCaption( s + " - " + tr("Text Editor") ); 828 setCaption( s + " - " + tr("Text Editor") );
829 } 829 }
830} 830}
831 831
832void TextEdit::setDocument(const QString& fileref) 832void TextEdit::setDocument(const QString& fileref)
833{ 833{
834 bFromDocView = TRUE; 834 bFromDocView = TRUE;
835 qDebug("setDocument "+fileref);
836 bFromDocView = TRUE;
837 if(fileref.find(".desktop",0,TRUE) == -1) {
835 openFile(fileref); 838 openFile(fileref);
836// bFromDocView = TRUE; 839 } else {
837// openFile(DocLnk(fileref)); 840 openFile(DocLnk(fileref));
838// showEditTools(); 841 }
839} 842}
840 843
841void TextEdit::closeEvent( QCloseEvent *e ) 844void TextEdit::closeEvent( QCloseEvent *e )
842{ 845{
843 if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { 846 if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) {
844 e->ignore(); 847 e->ignore();
845 repaint(); 848 repaint();
846// fileRevert(); 849// fileRevert();
847 850
848 } else { 851 } else {
849 bFromDocView = FALSE; 852 bFromDocView = FALSE;
850 e->accept(); 853 e->accept();
851 } 854 }
852} 855}
853 856
854void TextEdit::accept() 857void TextEdit::accept()
855{ 858{
856 save(); 859 save();
857 close(); 860 close();
858// fileOpen(); //godamn thats obnoxious! lemme out!!! 861// fileOpen(); //godamn thats obnoxious! lemme out!!!
859} 862}
860 863
861void TextEdit::changeFont() { 864void TextEdit::changeFont() {
862 FontDatabase fdb; 865 FontDatabase fdb;
863 QFont defaultFont=editor->font(); 866 QFont defaultFont=editor->font();
864 QFontInfo fontInfo(defaultFont); 867 QFontInfo fontInfo(defaultFont);
865 Config cfg("TextEdit"); 868 Config cfg("TextEdit");
866 cfg.setGroup("Font"); 869 cfg.setGroup("Font");
867 QString family = cfg.readEntry("Family", fontInfo.family()); 870 QString family = cfg.readEntry("Family", fontInfo.family());
868 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 871 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
869 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); 872 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
870 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); 873 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
871 874
872 defaultFont = fdb.font(family,style,i_size,charSet); 875 defaultFont = fdb.font(family,style,i_size,charSet);
873 876
874 FontDialog *fontDlg; 877 FontDialog *fontDlg;
875 fontDlg=new FontDialog(this,"FontDialog",TRUE); 878 fontDlg=new FontDialog(this,"FontDialog",TRUE);
876 879
877 fontDlg->exec(); 880 fontDlg->exec();
878 881
879 QFont myFont=fontDlg->selectedFont; 882 QFont myFont=fontDlg->selectedFont;
880 editor->setFont( myFont); 883 editor->setFont( myFont);
881 delete fontDlg; 884 delete fontDlg;
882 885
883} 886}
884 887
885void TextEdit::editDelete() 888void TextEdit::editDelete()
886{ 889{