Bug 117676

Summary: HTML export does not include location field
Product: [Applications] konsolekalendar Reporter: Andre Srinivasan <andre>
Component: generalAssignee: Allen Winter <winter>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Andre Srinivasan 2005-12-04 22:04:23 UTC
Version:           3.5 (using KDE 3.5.0-1.1.fc4.kde, Fedora Core release 4 (Stentz))
Compiler:          Target: i386-redhat-linux
OS:                Linux (i686) release 2.6.14-1.1637_FC4

Event list export to HTML or dumped to HTML via konsolekalendar do not include the location field.  Dumping to text via konsolekalendar also does not include the location field.  An XML dump via konsoleKalendar properly includes the location field.
Comment 1 Allen Winter 2005-12-19 20:51:46 UTC
SVN commit 489798 by winterz:

Provide the ability to print the incidence's Location field to the html export.

In konsolekalendar, the incidence location will always be printed to the html.
In korganizer, the location field print is configurable.

Note that permission has been granted by the docs team to introduce
a new i18n string with this patch.

Note also that this patch partially fixes several other bugs, like
#56713 and #63626.

CCMAIL: reinhold@kainhofer.com
BUGS: 117676



 M  +9 -7      korganizer/exportwebdialog.cpp  
 M  +31 -0     libkcal/htmlexport.cpp  
 M  +4 -3      libkcal/htmlexport.h  
 M  +8 -0      libkcal/htmlexportsettings.kcfg  


--- branches/KDE/3.5/kdepim/korganizer/exportwebdialog.cpp #489797:489798
@@ -64,9 +64,9 @@
 #include "exportwebdialog.moc"
 
 
-// FIXME: The basic structure of this dialog has been copied from KPrefsDialog, 
-//        because we want custom buttons, a Tabbed dialog, and a different 
-//        headline... Maybe we should try to achieve the same without code 
+// FIXME: The basic structure of this dialog has been copied from KPrefsDialog,
+//        because we want custom buttons, a Tabbed dialog, and a different
+//        headline... Maybe we should try to achieve the same without code
 //        duplication.
 ExportWebDialog::ExportWebDialog( HTMLExportSettings *settings, QWidget *parent,
                                   const char *name)
@@ -83,7 +83,7 @@
 
   connect( this, SIGNAL( user1Clicked() ), SLOT( slotOk() ) );
   connect( this, SIGNAL( cancelClicked() ), SLOT( reject() ) );
-  
+
   readConfig();
 }
 
@@ -157,9 +157,9 @@
 
   QGroupBox *destGroup = new QVGroupBox(i18n("Destination"), mGeneralPage );
   topLayout->addWidget(destGroup);
-  KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(), 
+  KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(),
                                        destGroup, "text/html", KFile::File );
-  connect( pathWid->urlRequester(), SIGNAL( textChanged( const QString & ) ), 
+  connect( pathWid->urlRequester(), SIGNAL( textChanged( const QString & ) ),
            SLOT( slotTextChanged( const QString & ) ) );
 
   topLayout->addStretch( 1 );
@@ -174,7 +174,7 @@
 {
   mTodoPage = addPage(i18n("To-dos"));
   QVBoxLayout *topLayout = new QVBoxLayout( mTodoPage, 10 );
-  
+
   QHBox *hbox = new QHBox( mTodoPage );
   topLayout->addWidget( hbox );
   addWidString( mSettings->todoListTitleItem(), hbox );
@@ -182,6 +182,7 @@
   QVBox *vbox = new QVBox( mTodoPage );
   topLayout->addWidget( vbox );
   addWidBool( mSettings->taskDueDateItem(), vbox );
+  addWidBool( mSettings->taskLocationItem(), vbox );
   addWidBool( mSettings->taskCategoriesItem(), vbox );
   addWidBool( mSettings->taskAttendeesItem(), vbox );
 //  addWidBool( mSettings->taskExcludePrivateItem(), vbox );
@@ -201,6 +202,7 @@
 
   QVBox *vbox = new QVBox( mEventPage );
   topLayout->addWidget( vbox );
+  addWidBool( mSettings->eventLocationItem(), vbox );
   addWidBool( mSettings->eventCategoriesItem(), vbox );
   addWidBool( mSettings->eventAttendeesItem(), vbox );
 //  addWidBool( mSettings->eventExcludePrivateItem(), vbox );
--- branches/KDE/3.5/kdepim/libkcal/htmlexport.cpp #489797:489798
@@ -223,6 +223,10 @@
   *ts << "    <th class=\"sum\">" << i18n("Start Time") << "</th>\n";
   *ts << "    <th>" << i18n("End Time") << "</th>\n";
   *ts << "    <th>" << i18n("Event") << "</th>\n";
+  if ( mSettings->eventLocation() ) {
+    *ts << "    <th>" << i18n("Location") << "</th>\n";
+    ++columns;
+  }
   if ( mSettings->eventCategories() ) {
     *ts << "    <th>" << i18n("Categories") << "</th>\n";
     ++columns;
@@ -285,6 +289,12 @@
   }
   *ts << "    </td>\n";
 
+  if ( mSettings->eventLocation() ) {
+    *ts << "  <td>\n";
+    formatLocation( ts, event );
+    *ts << "  </td>\n";
+  }
+
   if ( mSettings->eventCategories() ) {
     *ts << "  <td>\n";
     formatCategories( ts, event );
@@ -346,6 +356,10 @@
     *ts << "    <th>" << i18n("Due Date") << "</th>\n";
     ++columns;
   }
+  if ( mSettings->taskLocation() ) {
+    *ts << "    <th>" << i18n("Location") << "</th>\n";
+    ++columns;
+  }
   if ( mSettings->taskCategories() ) {
     *ts << "    <th>" << i18n("Categories") << "</th>\n";
     ++columns;
@@ -451,6 +465,14 @@
     *ts << "  </td>\n";
   }
 
+  if ( mSettings->taskLocation() ) {
+    *ts << "  <td";
+    if (completed) *ts << " class=\"done\"";
+    *ts << ">\n";
+    formatLocation(ts,todo);
+    *ts << "  </td>\n";
+  }
+
   if ( mSettings->taskCategories() ) {
     *ts << "  <td";
     if (completed) *ts << " class=\"done\"";
@@ -502,6 +524,15 @@
   return false;
 }
 
+void HtmlExport::formatLocation (QTextStream *ts,Incidence *event)
+{
+  if (!event->location().isEmpty()) {
+    *ts << "    " << cleanChars(event->location()) << "\n";
+  } else {
+    *ts << "    &nbsp;\n";
+  }
+}
+
 void HtmlExport::formatCategories (QTextStream *ts,Incidence *event)
 {
   if (!event->categoriesStr().isEmpty()) {
--- branches/KDE/3.5/kdepim/libkcal/htmlexport.h #489797:489798
@@ -69,17 +69,18 @@
     void createFreeBusyView( QTextStream *ts );
 
     void createTodo( QTextStream *ts, Todo *todo);
-    void createEvent( QTextStream *ts, Event *event, QDate date, 
+    void createEvent( QTextStream *ts, Event *event, QDate date,
                       bool withDescription = true);
     void createFooter( QTextStream *ts );
 
     bool checkSecrecy( Incidence * );
 
+    void formatLocation( QTextStream *ts, Incidence *event );
     void formatCategories( QTextStream *ts, Incidence *event );
     void formatAttendees( QTextStream *ts, Incidence *event );
- 
+
     QString breakString( const QString &text );
-    
+
     QDate fromDate() const;
     QDate toDate() const;
     QString styleSheet() const;
--- branches/KDE/3.5/kdepim/libkcal/htmlexportsettings.kcfg #489797:489798
@@ -78,6 +78,10 @@
       <default code="true">i18n("Calendar")</default>
     </entry>
 
+    <entry type="Bool" name="EventLocation" key="Export Location">
+      <label>Export location of the events</label>
+      <default>true</default>
+    </entry>
     <entry type="Bool" name="EventCategories" key="Export Categories">
       <label>Export categories of the events</label>
       <default>true</default>
@@ -103,6 +107,10 @@
       <label>Export due dates of the to-dos</label>
       <default>true</default>
     </entry>
+    <entry type="Bool" name="TaskLocation" key="Export Location">
+      <label>Export location of the to-dos</label>
+      <default>true</default>
+    </entry>
     <entry type="Bool" name="TaskCategories" key="Export Categories">
       <label>Export categories of the to-dos</label>
       <default>true</default>