[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice
From: Sebastian Sauer <mail () dipe ! org>
Date: 2007-11-30 23:28:44
Message-ID: 1196465324.197871.13168.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 743441 by sebsauer:
* added notifications for DocumentLoaded and DocumentSaved to KoDocument
* improved linkhandling in KSpread
* added KNotify-notifications for DocumentLoaded, DocumentSaved, LinkActivated and \
ValidityError to KSpread and allow to configure them
M +5 -4 kspread/CMakeLists.txt
M +1 -0 kspread/Doc.cpp
M +1 -0 kspread/Util.cpp
M +26 -14 kspread/Validity.cpp
A kspread/kspread.notifyrc
M +2 -1 kspread/kspread.rc
M +33 -22 kspread/ui/DefaultTool.cpp
M +11 -4 kspread/ui/View.cpp
M +1 -0 kspread/ui/View.h
M +17 -0 libs/kotext/opendocument/KoTextLoadingContext.h
M +13 -0 libs/main/KoDocument.cpp
--- trunk/koffice/kspread/CMakeLists.txt #743440:743441
@@ -209,6 +209,7 @@
target_link_libraries(kspreadcommon
${QT_QTSQL_LIBRARY}
+ ${KDE4_KNOTIFYCONFIG_LIBS}
komain koguiutils kochart
${KDE4_KDE3SUPPORT_LIBS} )
@@ -244,7 +245,7 @@
########### install files ###############
-install( FILES kspread.rc kspread_readonly.rc DESTINATION \
${DATA_INSTALL_DIR}/kspread)
-install( FILES kspreadpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-install( FILES kspread.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
-install( FILES kspread.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
+install( FILES kspread.rc kspread_readonly.rc kspread.notifyrc DESTINATION \
${DATA_INSTALL_DIR}/kspread) +install( FILES kspreadpart.desktop DESTINATION \
${SERVICES_INSTALL_DIR}) +install( FILES kspread.desktop DESTINATION \
${XDG_APPS_INSTALL_DIR}) +install( FILES kspread.kcfg DESTINATION \
${KCFG_INSTALL_DIR} )
--- trunk/koffice/kspread/Doc.cpp #743440:743441
@@ -904,6 +904,7 @@
//display loading time
kDebug(36001) <<"Loading took" << (float)(dt.elapsed()) / 1000.0 <<" seconds";
+
return true;
}
--- trunk/koffice/kspread/Util.cpp #743440:743441
@@ -329,6 +329,7 @@
bool KSpread::Util::localReferenceAnchor( const QString &_ref )
{
bool isLocalRef = (_ref.indexOf("http://") != 0 &&
+ _ref.indexOf("https://") != 0 &&
_ref.indexOf("mailto:") != 0 &&
_ref.indexOf("ftp://") != 0 &&
_ref.indexOf("file:") != 0 );
--- trunk/koffice/kspread/Validity.cpp #743440:743441
@@ -22,8 +22,12 @@
#include <float.h>
+// Qt
+#include <QTimer>
+
// KDE
#include <kmessagebox.h>
+#include <knotification.h>
// KOffice
#include <KoDom.h>
@@ -887,23 +891,31 @@
valid= true;
}
- if ( !valid && d->displayMessage )
+ if ( !valid )
{
- switch (d->action )
+ if ( d->displayMessage )
{
- case Stop:
- KMessageBox::error((QWidget*)0, d->message,
- d->title);
- break;
- case Warning:
- KMessageBox::warningYesNo((QWidget*)0, d->message,
- d->title);
- break;
- case Information:
- KMessageBox::information((QWidget*)0, d->message,
- d->title);
- break;
+ switch (d->action)
+ {
+ case Stop:
+ KMessageBox::error((QWidget*)0, d->message, d->title);
+ break;
+ case Warning:
+ KMessageBox::warningYesNo((QWidget*)0, d->message, d->title);
+ break;
+ case Information:
+ KMessageBox::information((QWidget*)0, d->message, d->title);
+ break;
+ }
}
+
+ KNotification *notify = new KNotification("ValidityError");
+ notify->setText( i18n("Validation for cell <i>%1</i> failed", \
cell->fullName()) ); + notify->addContext("cell", cell->fullName());
+ notify->addContext("value", cell->userInput());
+ notify->addContext("title", d->title);
+ notify->addContext("message", d->message);
+ QTimer::singleShot(0, notify, SLOT(sendEvent()));
}
return (valid || d->action != Stop);
}
--- trunk/koffice/kspread/kspread.rc #743440:743441
@@ -159,7 +159,8 @@
<Action name="showFormulaBar" group="settings_show" />
<Action name="showTabBar" group="settings_show" />
<Action name="showStatusBar" group="settings_show" />
- <Separator group="settings_show"/>
+
+ <Action name="configureNotifications" group="settings_configure"/>
<Action name="preference" group="settings_configure"/>
</Menu>
</MenuBar>
--- trunk/koffice/kspread/ui/DefaultTool.cpp #743440:743441
@@ -53,6 +53,7 @@
#include <kmessagebox.h>
#include <kmimetype.h>
#include <krun.h>
+#include <knotification.h>
#include <KoCanvasBase.h>
#include <KoPointerEvent.h>
@@ -679,35 +680,45 @@
void DefaultTool::Private::processLeftClickAnchor()
{
- bool isRefLink = Util::localReferenceAnchor( anchor );
- if ( !isRefLink )
- {
- KUrl url(anchor);
- if ( ! url.isValid() )
- return;
- const QString type = KMimeType::findByUrl(url, 0, \
url.isLocalFile())->name();
- if ( KRun::isExecutableFile( url, type ) )
- {
- QString question = i18n("This link points to the program or script \
'%1'.\n"
- "Malicious programs can harm your computer. "
- "Are you sure that you want to run this \
program?", anchor);
- // this will also start local programs, so adding a "don't warn again"
- // checkbox will probably be too dangerous
- int choice = KMessageBox::warningYesNo(canvas, question, i18n("Open \
Link?"));
- if ( choice != KMessageBox::Yes )
- return;
- }
- new KRun(url, canvas, 0, url.isLocalFile());
- }
- else
- {
+ KNotification *notify = new KNotification("LinkActivated");
+ notify->setText( i18n("Link <i>%1</i> activated", anchor) );
+ notify->addContext("anchor", anchor);
+
+ KUrl url(anchor);
+ if ( ! url.isValid() || url.isRelative() ) {
Region r(anchor, canvas->view()->doc()->map(), canvas->activeSheet());
if ( r.isValid() ) {
if ( r.firstSheet() != canvas->view()->activeSheet() )
canvas->view()->setActiveSheet( r.firstSheet() );
canvas->selection()->initialize(r);
+
+ if ( ! r.firstRange().isNull() ) {
+ QPoint p( r.firstRange().topLeft() );
+ notify->addContext("region", Cell(r.firstSheet(), p.x(), \
p.y()).fullName()); + }
}
}
+ else {
+ const QString type = KMimeType::findByUrl(url, 0, \
url.isLocalFile())->name(); + notify->addContext("type", type);
+ if ( ! Util::localReferenceAnchor(anchor) ) {
+ const bool executable = KRun::isExecutableFile( url, type );
+ notify->addContext("executable", QVariant(executable).toString());
+ if ( executable ) {
+ QString question = i18n("This link points to the program or script \
'%1'.\n" + "Malicious programs can harm your \
computer. " + "Are you sure that you want to \
run this program?", anchor); + // this will also start local programs, \
so adding a "don't warn again" + // checkbox will probably be too \
dangerous + int choice = KMessageBox::warningYesNo(canvas, question, \
i18n("Open Link?")); + if ( choice != KMessageBox::Yes )
+ return;
+ }
+ new KRun(url, canvas, 0, url.isLocalFile());
+ }
+ }
+
+ QTimer::singleShot(0, notify, SLOT(sendEvent()));
}
#include "DefaultTool.moc"
--- trunk/koffice/kspread/ui/View.cpp #743440:743441
@@ -86,6 +86,7 @@
#include <kpushbutton.h>
#include <kxmlguifactory.h>
#include <kicon.h>
+#include <knotifyconfigwidget.h>
// KOffice includes
#include <kdatatool.h>
@@ -1308,11 +1309,12 @@
connect(actions->showFormulaBar, SIGNAL(toggled(bool)),
view, SLOT(showFormulaBar(bool)));
- actions->preference = new KAction(KIcon("configure" ), i18n("Configure \
KSpread..."), view);
- ac->addAction("preference", actions->preference );
- connect(actions->preference, SIGNAL(triggered(bool)), view, SLOT( preference() ));
- actions->preference->setToolTip(i18n("Set various KSpread options"));
+ actions->preference = KStandardAction::preferences(view, SLOT(preference()), \
view); + actions->preference->setToolTip(i18n("Set various KSpread options"));
+ ac->addAction("preference", actions->preference);
+ KAction *notifyAction = KStandardAction::configureNotifications(view, \
SLOT(optionsNotifications()), view); + ac->addAction("configureNotifications", \
notifyAction);
// -- calculation actions --
//
@@ -5188,6 +5190,11 @@
refreshView();
}
+void View::optionsNotifications()
+{
+ KNotifyConfigWidget::configure( this );
+}
+
void View::preference()
{
if ( !d->activeSheet )
--- trunk/koffice/kspread/ui/View.h #743440:743441
@@ -416,6 +416,7 @@
void lower();
void equalizeColumn();
void equalizeRow();
+ void optionsNotifications();
void preference();
void firstLetterUpper();
void verticalText(bool );
--- trunk/koffice/libs/kotext/opendocument/KoTextLoadingContext.h #743440:743441
@@ -34,6 +34,23 @@
*
* This class extends the \a KoOasisLoadingContext class with KoText specific
* functionality like for example handling of lists.
+ *
+ * The context is used within the \a KoTextLoader class to provide additional
+ * state informations like the \a KoDocument and the \a KoStore we operate on.
+ *
+ * In the \a KoTextShapeData::loadOdf() method the \a KoTextLoader is used
+ * with a KoTextLoadingContext instance like this;
+ *
+ * \code
+ * KoStyleManager *stylemanager = new KoStyleManager();
+ * KoTextLoader *loader = new KoTextLoader(stylemanager);
+ * KoDocument* doc = oasisContext.koDocument();
+ * KoOdfStylesReader& styles = oasisContext.stylesReader();
+ * KoStore *store = oasisContext.store()
+ * KoTextLoadingContext *loaderContext = new KoTextLoadingContext(loader, doc, \
styles, store); + * QTextCursor cursor( document() );
+ * loader->loadBody(*loaderContext, element, cursor); // load the body from the ODF \
KoXmlElement. + * \endcode
*/
class KOTEXT_EXPORT KoTextLoadingContext : public KoOasisLoadingContext
{
--- trunk/koffice/libs/main/KoDocument.cpp #743440:743441
@@ -53,6 +53,7 @@
#include <kundostack.h>
#include <kdebug.h>
#include <kdeprintdialog.h>
+#include <knotification.h>
#include <QBuffer>
#include <QDir>
@@ -483,6 +484,13 @@
}
emit clearStatusBarMessage();
+ if ( ret ) {
+ KNotification *notify = new KNotification("DocumentSaved");
+ notify->setText( i18n("Document <i>%1</i> saved", url().url()) );
+ notify->addContext("url", url().url());
+ QTimer::singleShot(0, notify, SLOT(sendEvent()));
+ }
+
return ret;
}
@@ -1665,6 +1673,11 @@
if ( ok )
{
setMimeTypeAfterLoading( typeName );
+
+ KNotification *notify = new KNotification("DocumentLoaded");
+ notify->setText( i18n("Document <i>%1</i> loaded", url().url()) );
+ notify->addContext("url", url().url());
+ QTimer::singleShot(0, notify, SLOT(sendEvent()));
}
d->m_bLoading = false;
return ok;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic