[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/office/kraft
From:       Klaas Freitag <freitag () suse ! de>
Date:       2011-03-28 15:46:36
Message-ID: 20110328154636.5A3A7AC8CA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1226313 by freitag:

Improved the digestdetailsview

 M  +94 -30    reports/docdigest.trml  
 M  +1 -1      reports/pics/CMakeLists.txt  
 M  +4 -0      src/docdigest.h  
 M  +27 -4     src/docdigestdetailview.cpp  
 M  +5 -0      src/docdigestview.cpp  
 M  +8 -5      src/models/documentmodel.cpp  
 M  +4 -2      src/models/documentmodel.h  


--- trunk/playground/office/kraft/reports/docdigest.trml #1226312:1226313
@@ -1,13 +1,89 @@
-<!-- Check file docdigestview.css for stylesheet definition. It is added
-     to the html output automagically.
-  -->
+<html>
+<head>
+<style type="text/css">
+
+body {
+  padding: 0px;
+  margin: 0px;
+}
+#kopf {
+  height: 30px;
+  margin: 5px;
+  background-color: #ffff00;
+  vertical-align: middle;
+}
+#inhalt {
+  width: auto;
+  margin: 0px 280px;
+  
+  padding: 5px;
+  height: 140px;
+  
+}
+#links {
+  position: absolute;
+  top: 5px;
+  left: 5px;
+  width: 260px;
+  height: 140px;
+
+  background-color: #eeeeee;
+  padding: 5px;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+}
+#rechts {
+  position: absolute;
+  top: 5px;
+  right: 5px;
+  width: 270px;
+  height: 150px;
+  background-color: #ffcc00;
+  padding: 0px;
+  background-image: url(postit.png);
+  background-repeat:no-repeat;
+}
+
+#rechts #rcontent { 
+  padding-top: 34px;
+  padding-left: 28px;
+  padding-right: 28px;
+  padding-bottom: 5px;
+}
+
+#custimage {
+  background-image: url(kraft_customer.png);
+  background-repeat:no-repeat;
+  height: 48px;
+}
+
+#custlabel {
+  vertical-align: bottom;
+  margin-left: 53px;
+  font-size:1em; 
+  vertical-align:text-bottom;
+}
+
+p {
+  padding: 4px;
+}
+
+h2 {  
+  padding:2px 2px 2px 10px;
+  border-left:10px solid #57a62f;
+  border-bottom:1px solid #57a62f;
+}
+
+</style>
+</head>
 <body>
+<div id="inhalt">
 <h2>{{HEADLINE}}</h2>
-<div>
-<table width="100%">
-<tr>
-  <td width="300px">
-    <p>{{DATE}}</p>
+
+<p>{{DATE_LABEL}}: {{DATE}}</p>
+{{#PROJECT_INFO}}
+<p>{{PROJECT_LABEL}}: {{PROJECT}}</p>
+{{/PROJECT_INFO}}
     {{#PRINTED}}
     <p>Last printed: {{LAST_PRINT_DATE}}&nbsp;<a \
href="#show_last_print?id={{LAST_PRINTED_ID}}" title="opens last creatd PDF \
document">[show]</a></p>  <p>{{ARCHIVED_COUNT}} older prints</p>
@@ -15,27 +91,15 @@
     {{#NEVER_PRINTED}}
     <p>This document was never printed</p>
     {{/NEVER_PRINTED}}
-  </td>
-  <td>
-    <img align="left" src="kraft_customer.png"/>
-    {{#CLIENT_NOT_IN_ADDRESSBOOK_SECTION}}
-<p>The given client has the client Id {{CLIENTID}} but can not be found in this \
                addressbook.</p>
-    {{/CLIENT_NOT_IN_ADDRESSBOOK_SECTION}}
-    {{#CLIENT_UNKNOWN_SECTION}}
-<p>This client has no reference to an addressbook.</p>    
-    {{/CLIENT_UNKNOWN_SECTION}}
-    {{#CLIENT_ADDRESS_SECTION}}
-    <p>Client Address:</p>
-    <p>{{CLIENT_NAME}}</p>
-    <p>{{CLIENT_ORGANISATION}}</p>
-    <p>{{CLIENT_STREET}}</p>
-    <p>{{CLIENT_LOCALITY}}</p>
-    <p>{{CLIENT_ADDRESS_TYPE}}</p>
-    {{/CLIENT_ADDRESS_SECTION}}
-  </td>
-</tr>
-</table>
 </div>
+<div id="links">
+    <div id="custimage"><div id="custlabel">{{CUSTOMER_LABEL}}:</div></div>
+    <p>{{CUSTOMER_ADDRESS_FIELD}}</p>
+</div>
+<div id="rechts">
+  <div id="rcontent">
+   <p>{{WHITEBOARD}}</p>
+  </div>
+</div>
 </body>
-
-
+</html>
--- trunk/playground/office/kraft/reports/pics/CMakeLists.txt #1226312:1226313
@@ -6,4 +6,4 @@
 
 
 install(FILES lurchie.png DESTINATION ${DATA_INSTALL_DIR}/kraft/reports/images)
-install(FILES kraft_customer.png DESTINATION \
${DATA_INSTALL_DIR}/kraft/reports/images/docdigestdetailview) +install(FILES \
postit.png kraft_customer.png DESTINATION \
                ${DATA_INSTALL_DIR}/kraft/reports/images/docdigestdetailview)
--- trunk/playground/office/kraft/src/docdigest.h #1226312:1226313
@@ -40,6 +40,9 @@
   QString clientId() { return mClientId; }
   void setClientId( const QString& id ) { mClientId = id; }
 
+  QString clientAddress() { return mClientAddress; }
+  void setClientAddress( const QString& address ) { mClientAddress = address; }
+
   KABC::Addressee addressee() const;
   void setAddressee( const KABC::Addressee& );
 
@@ -77,6 +80,7 @@
   QString mIdent;
   QString mWhiteboard;
   QString mProjectLabel;
+  QString mClientAddress ;
 
   QDateTime   mLastModified;
   QDate       mDate;
--- trunk/playground/office/kraft/src/docdigestdetailview.cpp #1226312:1226313
@@ -97,19 +97,40 @@
 
   TextTemplate tmpl( mTemplFile ); // template file with name docdigest.trml
   tmpl.setValue( DOCDIGEST_TAG( "HEADLINE" ), digest.type() + " " + digest.ident() \
); +
   tmpl.setValue( DOCDIGEST_TAG( "DATE" ), digest.date() );
+  tmpl.setValue( DOCDIGEST_TAG( "DATE_LABEL" ), i18n("Date") );
+
+  tmpl.setValue( DOCDIGEST_TAG( "WHITEBOARD"), digest.whiteboard() );
+  tmpl.setValue( DOCDIGEST_TAG( "WHITEBOARD_LABEL"), i18n("Whiteboard"));
+
+  if( !digest.projectLabel().isEmpty() ) {
+    tmpl.createDictionary( "PROJECT_INFO" );
+    tmpl.setValue( "PROJECT_INFO", DOCDIGEST_TAG( "PROJECT"), digest.projectLabel() \
); +    tmpl.setValue( "PROJECT_INFO", DOCDIGEST_TAG( "PROJECT_LABEL"), \
i18n("Project")); +  }
+
   tmpl.setValue( "URL", mHtmlCanvas->baseURL().prettyUrl());
+  tmpl.setValue( DOCDIGEST_TAG( "CUSTOMER_LABEL" ), i18n("Customer"));
+
   KABC::Addressee addressee = digest.addressee();
+  QString adr = digest.clientAddress();
+  adr.replace('\n', "<br/>" );
+
+  tmpl.setValue( DOCDIGEST_TAG("CUSTOMER_ADDRESS_FIELD"),adr );
+
+  QString addressBookInfo;
   if( addressee.isEmpty() ) {
     if( digest.clientId().isEmpty() ) {
-      tmpl.createDictionary( "CLIENT_UNKNOWN_SECTION" );
+      addressBookInfo = i18n("The address is not listed in an address book.");
     } else {
-      tmpl.createDictionary( "CLIENT_NOT_IN_ADDRESSBOOK_SECTION");
-      tmpl.setValue( "CLIENT_NOT_IN_ADDRESSBOOK_SECTION", DOCDIGEST_TAG("CLIENTID"), \
digest.clientId() ); +      addressBookInfo = i18n("The client has the address book \
id %1 but can not found in our address books.").arg(digest.clientId());  }
   } else {
+    addressBookInfo  = i18n("The client can be found in our address books.");
     tmpl.createDictionary( "CLIENT_ADDRESS_SECTION");
     tmpl.setValue( "CLIENT_ADDRESS_SECTION", DOCDIGEST_TAG( "CLIENTID" ), \
digest.clientId() ); +    tmpl.setValue( "CLIENT_ADDRESS_SECTION", DOCDIGEST_TAG( \
                "CLIENT_ADDRESS" ), digest.clientAddress() );
     tmpl.setValue( "CLIENT_ADDRESS_SECTION", DOCDIGEST_TAG( "CLIENT_NAME"), \
                addressee.realName() );
     tmpl.setValue( "CLIENT_ADDRESS_SECTION", DOCDIGEST_TAG( "CLIENT_ORGANISATION"), \
                addressee.organization() );
     tmpl.setValue( "CLIENT_ADDRESS_SECTION", DOCDIGEST_TAG( "CLIENT_URL"), \
addressee.url().prettyUrl() ); @@ -157,6 +178,7 @@
     tmpl.setValue( "CLIENT_ADDRESS_SECTION", DOCDIGEST_TAG( "CLIENT_ADDRESS_TYPE" ), \
addressType );  
   }
+  tmpl.setValue( DOCDIGEST_TAG("CUSTOMER_ADDRESSBOOK_INFO"), addressBookInfo );
 
   // Information about archived documents.
   ArchDocDigestList archDocs = digest.archDocDigestList();
@@ -172,7 +194,8 @@
     tmpl.setValue( "PRINTED", DOCDIGEST_TAG("ARCHIVED_COUNT"), QString::number( \
archDocs.count()-1 ) );  }
 
-  mHtmlCanvas->displayContent( tmpl.expand() );
+  const QString details = tmpl.expand();
+  mHtmlCanvas->displayContent( details );
 
   kDebug() << "BASE-URL of htmlview is " << mHtmlCanvas->baseURL();
 
--- trunk/playground/office/kraft/src/docdigestview.cpp #1226312:1226313
@@ -208,6 +208,7 @@
   mLatestView->setModel( mLatestDocModel );
   mLatestView->sortByColumn(DocumentModel::Document_CreationDate, \
Qt::AscendingOrder);  mLatestView->hideColumn( DocumentModel::Document_ClientId );
+  mLatestView->hideColumn( DocumentModel::Document_ClientAddress );
   mLatestView->setSortingEnabled(true);
   mLatestView->header()->restoreState( QByteArray::fromBase64( \
KraftSettings::self()->digestListColumns().toAscii() ) );  
@@ -217,11 +218,15 @@
   mAllView->setModel(mAllDocumentsModel);
   mAllView->sortByColumn(DocumentModel::Document_CreationDate, Qt::DescendingOrder);
   mAllView->hideColumn( DocumentModel::Document_ClientId );
+  mAllView->hideColumn( DocumentModel::Document_ClientAddress );
   mAllView->setSortingEnabled(true);
 
   //Create the timeline view
   mTimelineModel = new TimelineModel(this);
   mTimeView->setModel(mTimelineModel);
+  mTimeView->hideColumn( DocumentModel::Document_ClientId );
+  mTimeView->hideColumn( DocumentModel::Document_ClientAddress );
+  mTimeView->setSortingEnabled(false);
 
   //Initialize common style options
   QPalette palette;
--- trunk/playground/office/kraft/src/models/documentmodel.cpp #1226312:1226313
@@ -66,8 +66,8 @@
     setHeaderData( 5 /* Document_LastModified */, Qt::Horizontal, i18n("Last \
                modified"));
     setHeaderData( 6 /* Document_CreationDate */, Qt::Horizontal, i18n("Creation \
                date"));
     setHeaderData( 7 /* Document_ProjectLabel */, Qt::Horizontal, i18n("Project \
                label"));
-    setHeaderData( 8 /* Document_ClientName */,   Qt::Horizontal, i18n("Client"));
-
+    setHeaderData( 8 /* Document_ClientAddress */,   Qt::Horizontal, i18n("Client \
Address")); +    setHeaderData( 9 /* Document_ClientName */,   Qt::Horizontal, \
i18n("Client"));  mAddressProvider = new AddressProvider( this );
     connect( mAddressProvider, SIGNAL( addresseeFound( const QString&, const \
                KABC::Addressee& )),
              this, SLOT( slotAddresseeFound( const QString&, const KABC::Addressee& \
))); @@ -76,7 +76,7 @@
 
 void DocumentModel::setQueryAgain()
 {
-   setQuery("SELECT docID, ident, docType, docDescription, clientID, lastModified, \
date, projectLabel " +   setQuery("SELECT docID, ident, docType, docDescription, \
clientID, lastModified, date, projectLabel, clientAddress "  "FROM document ORDER BY \
date DESC");  }
 
@@ -156,6 +156,9 @@
   digest.setDate( data( index.sibling( index.row(), Document_CreationDate ), \
RawTypes ).toDate() );  digest.setLastModified( data( index.sibling( index.row(), \
Document_LastModified), RawTypes ).toDateTime() );  
+  const QString clientAdr = data( index.sibling( index.row(), \
Document_ClientAddress), Qt::DisplayRole).toString(); +  digest.setClientAddress( \
clientAdr ); +
   QString ident = data( index.sibling( index.row(), Document_Ident), Qt::DisplayRole \
).toString();  digest.setIdent( ident );
   digest.setWhiteboard( data( index.sibling( index.row(), Document_Whiteboard), \
Qt::DisplayRole).toString() ); @@ -190,7 +193,7 @@
 
     return false;
 }
-
+#if 0
 int DocumentModel::columnCount(const QModelIndex &parent) const
 {
     if(!parent.isValid() || !parent.parent().isValid())
@@ -198,7 +201,7 @@
 
     return 0;
 }
-
+#endif
 QModelIndex DocumentModel::index(int row, int column, const QModelIndex &parent) \
const  {
     if (row < 0 || column < 0 || column >= columnCount() || parent.column() > 0)
--- trunk/playground/office/kraft/src/models/documentmodel.h #1226312:1226313
@@ -40,7 +40,9 @@
     Document_LastModified = 5,
     Document_CreationDate = 6,
     Document_ProjectLabel = 7,
-    Document_ClientName = 8
+    Document_ClientAddress = 8,
+    Document_ClientName = 9,
+
   };
 
   enum Roles
@@ -51,7 +53,7 @@
   // static DocumentModel *self();
   QVariant data(const QModelIndex &idx, int rol) const;
   bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
-  int columnCount(const QModelIndex &parent = QModelIndex()) const;
+  // int columnCount(const QModelIndex &parent = QModelIndex()) const;
   QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) \
const;  QModelIndex parent(const QModelIndex &index= QModelIndex()) const;
   QModelIndex sibling ( int row, int column, const QModelIndex & index ) const;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic