-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katebuffer.cpp | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 8c585f4..8f654d5 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp | |||
@@ -183,26 +183,27 @@ void Output::saveOutput() { | |||
183 | InputDialog *fileDlg; | 183 | InputDialog *fileDlg; |
184 | fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); | 184 | fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); |
185 | fileDlg->exec(); | 185 | fileDlg->exec(); |
186 | if( fileDlg->result() == 1 ) { | 186 | if( fileDlg->result() == 1 ) { |
187 | QString filename = QPEApplication::documentDir(); | 187 | QString filename = QPEApplication::documentDir(); |
188 | if(filename.right(1).find('/') == -1) | 188 | if(filename.right(1).find('/') == -1) |
189 | filename+="/"; | 189 | filename+="/"; |
190 | QString name = fileDlg->LineEdit1->text(); | 190 | QString name = fileDlg->LineEdit1->text(); |
191 | filename+="text/plain/"+name; | 191 | filename+="text/plain/"+name; |
192 | odebug << filename << oendl; | 192 | odebug << filename << oendl; |
193 | 193 | ||
194 | QFile f(filename); | 194 | QFile f(filename); |
195 | f.open( IO_WriteOnly); | 195 | if ( !f.open( IO_WriteOnly ) ) |
196 | if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { | 196 | owarn << "Could no open file" << oendl; |
197 | else if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { | ||
197 | DocLnk lnk; | 198 | DocLnk lnk; |
198 | lnk.setName(name); //sets file name | 199 | lnk.setName(name); //sets file name |
199 | lnk.setFile(filename); //sets File property | 200 | lnk.setFile(filename); //sets File property |
200 | lnk.setType("text/plain"); | 201 | lnk.setType("text/plain"); |
201 | if(!lnk.writeLink()) { | 202 | if(!lnk.writeLink()) { |
202 | odebug << "Writing doclink did not work" << oendl; | 203 | odebug << "Writing doclink did not work" << oendl; |
203 | } | 204 | } |
204 | } else | 205 | } else |
205 | owarn << "Could not write file" << oendl; | 206 | owarn << "Could not write file" << oendl; |
206 | f.close(); | 207 | f.close(); |
207 | } | 208 | } |
208 | } | 209 | } |
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp index 4c15fd0..d89edbd 100644 --- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp +++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp | |||
@@ -63,25 +63,28 @@ KWBuffer::clear() | |||
63 | /** | 63 | /** |
64 | * Insert a file at line @p line in the buffer. | 64 | * Insert a file at line @p line in the buffer. |
65 | */ | 65 | */ |
66 | void | 66 | void |
67 | KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) | 67 | KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) |
68 | { | 68 | { |
69 | if (line) { | 69 | if (line) { |
70 | odebug << "insert File only supports insertion at line 0 == file opening" << oendl; | 70 | odebug << "insert File only supports insertion at line 0 == file opening" << oendl; |
71 | return; | 71 | return; |
72 | } | 72 | } |
73 | clear(); | 73 | clear(); |
74 | QFile iofile(file); | 74 | QFile iofile(file); |
75 | iofile.open(IO_ReadOnly); | 75 | if (!iofile.open(IO_ReadOnly)) { |
76 | owarn << "failed to open file " << iofile.name() << oendl; | ||
77 | return; | ||
78 | } | ||
76 | QTextStream stream(&iofile); | 79 | QTextStream stream(&iofile); |
77 | stream.setCodec(codec); | 80 | stream.setCodec(codec); |
78 | QString qsl; | 81 | QString qsl; |
79 | int count=0; | 82 | int count=0; |
80 | for (count=0;((qsl=stream.readLine())!=QString::null); count++) | 83 | for (count=0;((qsl=stream.readLine())!=QString::null); count++) |
81 | { | 84 | { |
82 | if (count==0) | 85 | if (count==0) |
83 | { | 86 | { |
84 | (*m_stringListIt)->append(qsl.unicode(),qsl.length()); | 87 | (*m_stringListIt)->append(qsl.unicode(),qsl.length()); |
85 | } | 88 | } |
86 | else | 89 | else |
87 | { | 90 | { |