[prev in list] [next in list] [prev in thread] [next in thread]
List: quanta-devel
Subject: [quanta-devel] patch for preview of read-only files
From: Jens Herden <jens () kdewebdev ! org>
Date: 2006-03-14 14:33:21
Message-ID: 200603142133.27130.jens () kdewebdev ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
Hi Andras,
here another patch for the problem we discussed already: the preview if a file
is read-only. I simply open the original if the copy fails to create the
preview-* file. No elegant but works.
I also removed some useless lines.
Please review and if it is OK please commit. Because I do not know if I will
have time during the next days and I want this in the next release.
Thanks
Jens
["preview.patch" (text/x-diff)]
Index: quanta/src/quanta.cpp
===================================================================
--- quanta/src/quanta.cpp (revision 518528)
+++ quanta/src/quanta.cpp (working copy)
@@ -750,7 +750,7 @@
else
{
url = Project::ref()->urlWithPrefix(w->url());
- m_htmlPart->setPreviewedURL(url, noFramesText);
+ m_htmlPart->setPreviewedURL(url);
m_htmlPart->begin(url, xOffset, yOffset);
}
m_htmlPart->write(noFramesText);
@@ -775,7 +775,7 @@
{
m_previewedDocument = w;
url = Project::ref()->urlWithPrefix(w->url());
- m_htmlPart->setPreviewedURL(url, text);
+ m_htmlPart->setPreviewedURL(url);
KURL previewURL = w->url();
previewURL.setFileName("preview-" + previewURL.fileName());
//save the content to disk, so preview with prefix works
@@ -791,7 +791,9 @@
tmpFile->textStream()->setCodec(QTextCodec::codecForName(encoding));
*(tmpFile->textStream()) << w->editIf->text();
tmpFile->close();
- QExtFileInfo::copy(KURL::fromPathOrURL(tempFileName), previewURL, -1, true);
+ if (!QExtFileInfo::copy(KURL::fromPathOrURL(tempFileName), previewURL, -1, true)) {
+ m_htmlPart->setPreviewedURL(KURL()); // copy failed, force the preview of the original
+ };
delete tmpFile;
m_htmlPart->openURL(url);
m_htmlPart->addToHistory(url.url());
Index: quanta/parts/preview/whtmlpart.cpp
===================================================================
--- quanta/parts/preview/whtmlpart.cpp (revision 518528)
+++ quanta/parts/preview/whtmlpart.cpp (working copy)
@@ -68,9 +68,8 @@
{
}
-void WHTMLPart::setPreviewedURL(const KURL &url, const QString& text)
+void WHTMLPart::setPreviewedURL(const KURL &url)
{
- m_previewedText = text;
m_previewedURL = url;
}
Index: quanta/parts/preview/whtmlpart.h
===================================================================
--- quanta/parts/preview/whtmlpart.h (revision 518528)
+++ quanta/parts/preview/whtmlpart.h (working copy)
@@ -34,9 +34,8 @@
QObject *parent = 0, const char *name = 0, GUIProfile prof = DefaultGUI );
virtual ~WHTMLPart();
- /** Specify the URL where the preview was started and the
- content of this url as well.*/
- void setPreviewedURL(const KURL &url, const QString &text);
+ /** Specify the URL where the preview was started */
+ void setPreviewedURL(const KURL &url);
bool backEnable();
bool forwardEnable();
virtual bool openURL(const KURL &url);
@@ -69,7 +68,6 @@
private:
KURL m_previewedURL;
KPopupMenu *m_contextMenu;
- QString m_previewedText;
QStrList history;
unsigned int hpos;
bool m_enableViewSource;
[Attachment #8 (application/pgp-signature)]
_______________________________________________
quanta-devel mailing list
quanta-devel@kde.org
https://mail.kde.org/mailman/listinfo/quanta-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic