[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/office/kraft/src
From: Klaas Freitag <freitag () suse ! de>
Date: 2007-01-02 18:52:09
Message-ID: 1167763929.348075.19490.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 619096 by freitag:
added action to open archived documents
M +24 -7 docdigestview.cpp
M +7 -1 docdigestview.h
M +2 -0 kraftui.rc
M +35 -3 portal.cpp
M +7 -3 portal.h
M +9 -5 portalview.cpp
M +3 -0 portalview.h
--- trunk/playground/office/kraft/src/docdigestview.cpp #619095:619096
@@ -100,9 +100,9 @@
ArchDocDigestList archDocList = ( *it ).archDocDigestList();
ArchDocDigestList::iterator archIt;
for ( archIt = archDocList.begin(); archIt != archDocList.end(); ++archIt ) {
- ( void ) new KListViewItem( item, i18n( "Archived" ), QString(),
- ( *archIt ).printDateString() );
-
+ KListViewItem *archItem = new KListViewItem( item, i18n( "Archived" ), QString(),
+ ( *archIt ).printDateString() );
+ mArchIdDict[archItem] = (*archIt).archDocId();
}
}
return chapIt;
@@ -126,6 +126,11 @@
emit openDocument( id );
}
+
+ dbID archId = mArchIdDict[ item ];
+ if ( archId.isOk() ) {
+ emit openArchivedDocument( archId );
+ }
}
void DocDigestView::slotOpenCurrentDoc()
@@ -133,6 +138,17 @@
slotDocOpenRequest( mListView->currentItem() );
}
+dbID DocDigestView::currentArchiveDocId()
+{
+ dbID id;
+
+ QListViewItem *current = mListView->currentItem();
+ if( current ) {
+ id = mArchIdDict[current];
+ }
+ return id;
+}
+
QString DocDigestView::currentDocumentId()
{
QString res;
@@ -146,12 +162,13 @@
void DocDigestView::slotCurrentChanged( QListViewItem *item )
{
+ dbID id = mArchIdDict[item];
QString res;
- if( item ) {
- res = mDocIdDict[item];
+ if ( mDocIdDict[item] ) {
+ emit docSelected( mDocIdDict[item] );
+ } else if ( id.isOk() ) {
+ emit archivedDocSelected( mArchIdDict[item] );
}
- kdDebug() << "Current doc selection changed to " << res << endl;
- emit selectionChanged( res );
}
#include "docdigestview.moc"
--- trunk/playground/office/kraft/src/docdigestview.h #619095:619096
@@ -27,6 +27,7 @@
class FilterHeader;
class QPopupMenu;
class QPushButton;
+class dbID;
class DocDigestView : public QWidget
{
@@ -46,6 +47,8 @@
QPopupMenu *contextMenu() {
return mContextMenu;
}
+ dbID currentArchiveDocId();
+
public slots:
void slotNewDoc();
void slotDocOpenRequest( QListViewItem * );
@@ -57,7 +60,9 @@
signals:
void createDocument();
void openDocument( const QString& );
- void selectionChanged( const QString& );
+ void openArchivedDocument( const dbID& );
+ void docSelected( const QString& );
+ void archivedDocSelected( const dbID& );
void printDocument( const QString& );
private:
KListView *mListView;
@@ -65,6 +70,7 @@
QPopupMenu *mContextMenu;
QPushButton *mNewDocButton;
QMap<QListViewItem*, QString> mDocIdDict;
+ QMap<QListViewItem*, dbID> mArchIdDict;
};
#endif
--- trunk/playground/office/kraft/src/kraftui.rc #619095:619096
@@ -5,12 +5,14 @@
<Action name="document_new"/>
<Action name="document_open"/>
<Action name="document_print"/>
+ <Action name="archived_open"/>
</Menu>
</MenuBar>
<ToolBar name="documentToolBar" fullWidth="true">
<Action name="document_new"/>
<Action name="document_open"/>
<Action name="document_print"/>
+ <Action name="archived_open"/>
</ToolBar>
</kpartgui>
--- trunk/playground/office/kraft/src/portal.cpp #619095:619096
@@ -110,9 +110,14 @@
SLOT(slotPrintDocument()),
actionCollection(), "document_print");
+ actOpenArchivedDocument = new KAction( i18n( "Open &Archived Document" ), "attach",
+ KShortcut( ), this,
+ SLOT( slotArchivedDocExecuted() ), actionCollection(),
+ "archived_open" );
+
actOpenDocument = new KAction(i18n("&Open Document"), "fileopen",
- KStdAccel::shortcut(KStdAccel::Open), this,
- SLOT( slotOpenDocument() ), actionCollection(), "document_open" );
+ KStdAccel::shortcut(KStdAccel::Open), this,
+ SLOT( slotOpenDocument() ), actionCollection(), "document_open" );
fileQuit->setStatusText(i18n("Quits the application"));
editCut->setStatusText(i18n("Cuts the selected section and puts it to the clipboard"));
@@ -123,10 +128,11 @@
actNewDocument->setStatusText( i18n( "Creates a new Document" ) );
actPrintDocument->setStatusText( i18n( "Print and archive this Document" ) );
actOpenDocument->setStatusText( i18n( "Opens the document for editing" ) );
-
+ actOpenArchivedDocument->setStatusText( i18n( "Open a viewer on an archived document" ) );
setStandardToolBarMenuEnabled( true );
actOpenDocument->setEnabled( false );
actPrintDocument->setEnabled( false );
+ actOpenArchivedDocument->setEnabled( false );
// use the absolute path to your kraftui.rc file for testing purpose in createGUI();
char *prjPath = getenv("KRAFT_HOME");
if( prjPath ) {
@@ -160,6 +166,7 @@
actNewDocument->plug( m_portalView->docDigestView()->contextMenu() );
actPrintDocument->plug( m_portalView->docDigestView()->contextMenu() );
actOpenDocument->plug( m_portalView->docDigestView()->contextMenu() );
+ actOpenArchivedDocument->plug( m_portalView->docDigestView()->contextMenu() );
connect( m_portalView, SIGNAL(openKatalog( const QString&)),
this, SLOT(slotOpenKatalog(const QString&)));
@@ -171,10 +178,14 @@
this, SLOT( slotNewDocument() ) );
connect( m_portalView, SIGNAL( openDocument( const QString& ) ),
this, SLOT( slotOpenDocument( const QString& ) ) );
+ connect( m_portalView, SIGNAL( openArchivedDocument( const dbID& ) ),
+ this, SLOT( slotPrintDocument( const dbID& ) ) );
connect( m_portalView, SIGNAL( printDocument( const QString& ) ),
this, SLOT( slotPrintDocument() ) );
connect( m_portalView, SIGNAL( documentSelected( const QString& ) ),
this, SLOT( slotDocumentSelected( const QString& ) ) );
+ connect( m_portalView, SIGNAL( archivedDocSelected( const dbID& ) ),
+ this, SLOT( slotArchivedDocSelected( const dbID& ) ) );
setCentralWidget(m_portalView);
}
@@ -302,6 +313,7 @@
void Portal::slotPrintDocument( const dbID& archID )
{
if ( archID.isOk() ) {
+ slotStatusMsg(i18n("Printing archived document...") );
mReportGenerator = ReportGenerator::self();
mReportGenerator->createRmlFromArchive( archID ); // work on document identifier.
}
@@ -329,9 +341,29 @@
} else {
actOpenDocument->setEnabled( true );
actPrintDocument->setEnabled( true );
+ actOpenArchivedDocument->setEnabled( false );
}
}
+void Portal::slotArchivedDocExecuted()
+{
+
+ dbID id = m_portalView->docDigestView()->currentArchiveDocId();
+
+ kdDebug() << "archived doc selected: " << id.toString() << endl;
+ slotPrintDocument( id );
+}
+
+void Portal::slotArchivedDocSelected( const dbID& id )
+{
+ // slotDocumentSelected( QString() );
+ if ( id.isOk() ) {
+ actOpenArchivedDocument->setEnabled( true );
+ actOpenDocument->setEnabled( false );
+ actPrintDocument->setEnabled( false );
+ }
+}
+
void Portal::createView( DocGuardedPtr doc )
{
// FIXME: We allow only one view for the first time.
--- trunk/playground/office/kraft/src/portal.h #619095:619096
@@ -7,7 +7,8 @@
***************************************************************************/
/***************************************************************************
- * *
+ *
+ *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -107,8 +108,8 @@
* @param text the text that is displayed in the statusbar
*/
void slotStatusMsg(const QString &text);
- /** Show the window with floskeltemplates */
- void slotShowTemplates();
+ /** Show the window with floskeltemplates */
+ void slotShowTemplates();
void slotOpenKatalog(const QString& );
void slotOpenKatalog();
@@ -118,6 +119,8 @@
void slotOpenDocument( const QString& );
void slotOpenDocument();
void slotDocumentSelected( const QString& );
+ void slotArchivedDocExecuted();
+ void slotArchivedDocSelected( const dbID& );
void slotPrintDocument();
void slotPrintDocument( const dbID& );
void slotViewClosed( bool );
@@ -149,6 +152,7 @@
KAction* actNewDocument;
KAction* actOpenDocument;
KAction* actPrintDocument;
+ KAction* actOpenArchivedDocument;
KToggleAction* viewFlosTemplates;
KToggleAction* viewStatusBar;
--- trunk/playground/office/kraft/src/portalview.cpp #619095:619096
@@ -265,13 +265,17 @@
mDocDigestView = new DocDigestView( parent );
connect( mDocDigestView, SIGNAL( createDocument() ),
- SIGNAL( createDocument() ) );
+ SIGNAL( createDocument() ) );
connect( mDocDigestView, SIGNAL( openDocument( const QString& ) ),
- SIGNAL( openDocument( const QString& ) ) );
+ SIGNAL( openDocument( const QString& ) ) );
+ connect( mDocDigestView, SIGNAL( openArchivedDocument( const dbID& ) ),
+ SIGNAL( openArchivedDocument( const dbID& ) ) );
connect( mDocDigestView, SIGNAL( printDocument( const QString& ) ),
- SIGNAL( printDocument( const QString& ) ) );
- connect( mDocDigestView, SIGNAL( selectionChanged( const QString& ) ),
- SIGNAL( documentSelected( const QString& ) ) );
+ SIGNAL( printDocument( const QString& ) ) );
+ connect( mDocDigestView, SIGNAL( docSelected( const QString& ) ),
+ SIGNAL( documentSelected( const QString& ) ) );
+ connect( mDocDigestView, SIGNAL( archivedDocSelected( const dbID& ) ),
+ SIGNAL( archivedDocSelected( const dbID& ) ) );
}
void PortalView::slotBuildView()
--- trunk/playground/office/kraft/src/portalview.h #619095:619096
@@ -36,6 +36,7 @@
class QListViewItem;
class DocDigestView;
class KTextBrowser;
+class dbID;
class PortalView : public KJanusWidget
{
@@ -60,7 +61,9 @@
void katalogToXML( const QString& );
void createDocument();
void openDocument( const QString& );
+ void openArchivedDocument( const dbID& );
void documentSelected( const QString& );
+ void archivedDocSelected( const dbID& );
void printDocument( const QString& );
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic