Show confidential meeting details setting added
authorTimo Holopainen <holopti@holopti-desktop.(none)>
Mon, 24 Aug 2009 08:23:38 +0000 (11:23 +0300)
committerTimo Holopainen <holopti@holopti-desktop.(none)>
Mon, 24 Aug 2009 08:23:38 +0000 (11:23 +0300)
Squashed commit of the following:

commit d8ce7147dfa33ee9bb79e10b09b3a82018bdb05b
Author: Timo Holopainen <holopti@holopti-desktop.(none)>
Date:   Mon Aug 24 11:03:06 2009 +0300

    Show confidential meeting details setting added to settings. Meeting view updated to support that privacy setting.

src/Domain/Configuration/Configuration.cpp
src/Domain/Configuration/Configuration.h
src/UserInterface/Views/MeetingInfoDialog.cpp
src/UserInterface/Views/SettingsView.cpp
src/UserInterface/Views/SettingsView.h

index ae3c431..997711b 100644 (file)
@@ -19,7 +19,9 @@ QString Configuration::sConfigurationPath = "/etc/QtMeetings.conf";
 
 Configuration::Configuration() :
        iConnectionSettings(0), iStartupSettings(0), iDisplaySettings(0),
-                       iDateTimeSettings(0) {
+       iDateTimeSettings(0), 
+       iShowConfidentialMeetingDetails(false)
+{
 }
 
 Configuration::~Configuration() {
@@ -123,6 +125,8 @@ void Configuration::save() {
 
        saveAdminPassword(root);
 
+       bool confidentialMeetingDetailsElementMissing = true;
+
        for (QDomNode node = root.firstChild(); !node.isNull(); node
                        = node.nextSibling()) {
                QDomElement e = node.toElement();
@@ -139,7 +143,17 @@ void Configuration::save() {
                        saveDisplaySettings(node);
                } else if (tagName == QString("daylight_saving_time")) {
                        saveDateTimeSettings(node);
-               }
+               } else if (tagName == QString("privacy")) {
+                       confidentialMeetingDetailsElementMissing = false;
+                       savePrivacySettings(node);
+               }               
+       }
+
+       if( confidentialMeetingDetailsElementMissing )
+       {
+               QDomElement e = root.ownerDocument().createElement("privacy");
+               savePrivacySettings(e);
+               root.appendChild(e);
        }
 
        //! Empty the file from previous content and write again with new one
@@ -163,7 +177,6 @@ void Configuration::saveConnectionSettings(const QDomNode &aXML) {
                        QDomText t = node.ownerDocument().createTextNode(
                                        iConnectionSettings->serverUrl().toString());
                        if (e.hasChildNodes()) {
-
                                e.replaceChild(t, e.firstChild());
                        } else {
                                e.appendChild(t);
@@ -356,7 +369,6 @@ void Configuration::readFromXML(const QString &aPath) {
 
                if (tagName == QString("connection")) {
                        iConnectionSettings = readConnectionSettings(node);
-
                } else if (tagName == QString("rooms")) {
                        iRooms = readRooms(node);
                } else if (tagName == QString("language")) {
@@ -366,7 +378,9 @@ void Configuration::readFromXML(const QString &aPath) {
                } else if (tagName == QString("display")) {
                        iDisplaySettings = readDisplaySettings(node);
                } else if (tagName == QString("daylight_saving_time")) {
-                       iDateTimeSettings = /*Configuration::*/readDateTimeSettings(node);
+                       iDateTimeSettings = readDateTimeSettings(node);
+               } else if (tagName == QString("privacy")) {
+                       readPrivacySettings(node);
                }
        }
 }
@@ -621,6 +635,46 @@ void Configuration::setRooms(const QList<Room*> aRooms) {
        iRooms = aRooms;
 }
 
+void Configuration::readPrivacySettings(const QDomNode &aXML) {
+       QString s = QString("show_confidential_meeting_details");
+
+       QDomElement e = aXML.firstChildElement(s);
+
+       if (e.hasAttribute("enabled") && 
+               e.attribute("enabled") == QString("true")) {
+               iShowConfidentialMeetingDetails = true;
+       }
+       else
+       {
+               iShowConfidentialMeetingDetails = false;
+       }
+}
+
+void Configuration::savePrivacySettings(QDomNode &aXML) {
+       QString s = QString("show_confidential_meeting_details");
+
+       QDomElement e = aXML.firstChildElement(s);
+
+       if (e.isNull()) {
+               e = aXML.ownerDocument().createElement(s);
+               aXML.appendChild(e);
+       }
+
+       if( showConfidentialMeetingDetails() )
+               e.setAttribute("enabled", "true");
+       else
+               e.setAttribute("enabled", "false");
+}
+
+bool Configuration::setShowConfidentialMeetingDetails(
+               bool showconfidentialmeetingdetails) {
+       iShowConfidentialMeetingDetails = showconfidentialmeetingdetails;
+}
+
+bool Configuration::showConfidentialMeetingDetails() {
+       return iShowConfidentialMeetingDetails;
+}
+
 QString Configuration::hashPassword(const QString aPassword) {
        QCryptographicHash *hash = new QCryptographicHash(QCryptographicHash::Md5);
        hash->addData(aPassword.toUtf8());
index 45f9912..9c5c253 100644 (file)
@@ -79,6 +79,14 @@ public:
         * Sets the refresh interval
         */
        void setRefreshinterval(unsigned int refreshinterval);
+       
+       //! Sets the confidential meeting details showing setting.
+       /*!
+        * Sets the confidential meeting details showing setting.
+        * \param confidential meeting details showing setting.
+        */
+       bool setShowConfidentialMeetingDetails(bool showconfidentialmeetingdetails);
+       
        //! Gets the detault room.
        /*!
         * Gets the default meeting room.
@@ -123,11 +131,18 @@ public:
        QByteArray adminPassword();
        //! Sets room list.
        /*!
-        * Sets  room list.
+        * Sets room list.
         * \param aRooms List of rooms
         */
        void setRooms(const QList<Room*> aRooms);
 
+       //! Gets the confidential meeting details showing setting.
+       /*!
+        * Gets the confidential meeting details showing setting.
+        * \return confidential meeting details showing setting.
+        */
+       bool showConfidentialMeetingDetails();
+       
 signals:
        void configurationChanged();
 
@@ -153,41 +168,41 @@ private:
         * \param aXml QDomNode containing connection parameters.
         * \return Pointer to ConnectionSettings object.
         */
-       static ConnectionSettings* readConnectionSettings(const QDomNode &aXML);
+       ConnectionSettings* readConnectionSettings(const QDomNode &aXML);
        //! Static. Reads rooms from an XML node.
        /*!
         * Static. Reads rooms from an XML node.
         * \param aXml QDomNode containing meeting room parameters
         * \return List of meetingrooms.
         */
-       static QList<Room*> readRooms(const QDomNode &aXML);
+       QList<Room*> readRooms(const QDomNode &aXML);
        //! Static. Reads language code from an XML node.
        /*!
         * Static. Reads rooms from an XML node.
         * \param aXml QDomNode containing language code
         * \return Language code.
         */
-       static QString readLanguageCode(const QDomNode &aXML);
+       QString readLanguageCode(const QDomNode &aXML);
        //! Static. Reads settings of startup from an XML node.
        /*!
         * Static. Reads settings of startup from an XML node.
         * \param aXml QDomNode containing startup parameters
         * \return Pointer to the read StartupSettings object.
         */
-       static StartupSettings* readStartupSettings(const QDomNode &aXML);
+       StartupSettings* readStartupSettings(const QDomNode &aXML);
        /*!
         * Static function to load and store display settings from xml node.
         * \param aXml QDomNode containing display parameters
         * \return Pointer to the read DisplaySettings object.
         */
-       static DisplaySettings* readDisplaySettings(const QDomNode &aXML);
+       DisplaySettings* readDisplaySettings(const QDomNode &aXML);
        //! Static. Reads the date/time settings from an XML node.
        /*!
         * Static. Reads the date/time settings from an XML node.
         * \param aXml QDomNode containing the date/time settings
         * \return The date/time settings.
         */
-       static DateTimeSettings* readDateTimeSettings(const QDomNode &aXML);
+       DateTimeSettings* readDateTimeSettings(const QDomNode &aXML);
 
        //! Static. Reads adminstrator's password from an XML node.
        /*!
@@ -195,8 +210,16 @@ private:
         * \param aXml QDomNode containing admin password
         * \return Admin password.
         */
-       static QByteArray readAdminPassword(const QDomNode &aXML);
+       QByteArray readAdminPassword(const QDomNode &aXML);
 
+       //! Static. Reads confidential meeting details setting from an XML node.
+       /*!
+        * Static. Reads confidential meeting details setting from an XML node.
+        * \param aXml QDomNode containing confidential meeting details setting
+        * \return Confidential meeting details setting.
+        */
+       void readPrivacySettings(const QDomNode &aXML);
+       
        //! Saves connection data to the document.
        /*!
         * Reads data from iConnectionSettings and saves it to the aXML document.
@@ -241,6 +264,13 @@ private:
         */
        void saveAdminPassword(const QDomNode &aXML);
 
+       //! Saves confidential meeting details setting to the document.
+       /*!
+        * Reads data from iShowConfidentialMeetingDetails and saves it to the aXML document.
+        * \param aXml QDomNode confidential meeting details setting
+        */
+       void savePrivacySettings(QDomNode &aXML);
+               
        //! Hash password with md5 method.
        /*!
         * Hash password with md5 method.
@@ -271,6 +301,7 @@ private:
        //! Stores language code
        QString iLanguageCode;
 
+       bool iShowConfidentialMeetingDetails;
 };
 
 #endif /*CONFIGURATION_H_*/
index 9a08de9..760eca9 100644 (file)
@@ -1,7 +1,10 @@
 #include "MeetingInfoDialog.h"
+
 #include "ToolBox.h"
 #include "Meeting.h"
 #include "Room.h"
+#include "Configuration.h"
+
 #include <QLabel>
 #include <QVBoxLayout>
 #include <QPushButton>
@@ -43,11 +46,30 @@ void MeetingInfoDialog::createDialogView(Meeting *aMeeting)
        boldFont.setBold( true );
 
        QLabel *subjectLabel = ToolBox::createLabel( tr( "Subject:" ), boldFont );
-       QLabel *subjectContent = ToolBox::createLabel( aMeeting->subject(), normalFont );
+       QLabel *subjectContent = new QLabel();
+       subjectContent->setFont( normalFont );
 
        QLabel *descriptionLabel = ToolBox::createLabel( tr( "Description:" ), boldFont );
        QTextEdit *descriptionContent = new QTextEdit( "" );
-       descriptionContent->setHtml( aMeeting->description() );
+
+       if( Configuration::instance()->showConfidentialMeetingDetails() )
+       {
+               subjectContent->setText( aMeeting->subject() );
+               descriptionContent->setHtml( aMeeting->description() );
+       }
+
+       if( subjectContent->text().isEmpty() )
+       {
+               subjectContent->setText( tr( "Room reserved", "Meeting Info Subject" ) ); // default subject text
+       }
+
+       qDebug() << "############ Desc: " << descriptionContent->toPlainText().trimmed();
+
+       if( descriptionContent->toPlainText().trimmed().isEmpty() )
+       {
+               descriptionContent->setPlainText( tr( "Room reserved", "Meeting Info Description" ) ); // default description text
+       }
+
        descriptionContent->setReadOnly( true );
        descriptionContent->setFont( normalFont );
 
index 0cdb380..fad4c15 100644 (file)
@@ -75,7 +75,8 @@ SettingsView::SettingsView( QWidget *aParent ) :
 
 SettingsView::~SettingsView()
 {
-       QT_DELETE(iOkButton);
+       qDebug() << "[SettingsView::~SettingsView]";
+       /*QT_DELETE(iOkButton);
        QT_DELETE(iCancelButton);
        QT_DELETE(iUserName);
        QT_DELETE(iPassword);
@@ -88,12 +89,12 @@ SettingsView::~SettingsView()
        QT_DELETE(iPowerSaveEnabled);
        QT_DELETE(iPowerSaveStartTime);
        QT_DELETE(iPowerSaveEndTime);
+       QT_DELETE(iShowConfidentialMeetingDetails);
        QT_DELETE(iSettingsTab);
        QT_DELETE(iWeekViewTab);
        QT_DELETE(iResourcesTab);
        QT_DELETE(iKioskModeTab);
-       QT_DELETE(iTabWidget);
-
+       QT_DELETE(iTabWidget);*/
 }
 
 QWidget *SettingsView::initSettingsTab()
@@ -112,6 +113,7 @@ QWidget *SettingsView::initSettingsTab()
        // Create the group boxes
        QGroupBox *userInformationGroup = new QGroupBox( tr( "User Information" ) );
        QGroupBox *serverInformationGroup = new QGroupBox( tr( "Server Information" ) );
+       QGroupBox *privacySettingsGroup = new QGroupBox( tr( "Privacy Settings" ) );
 
        // Prepare the user infromation group box
        QGridLayout *ugl = new QGridLayout;
@@ -139,10 +141,19 @@ QWidget *SettingsView::initSettingsTab()
 
        serverInformationGroup->setLayout( sgl );
 
+       // Prepare meeting info setting box
+       QGridLayout *pgl = new QGridLayout;
+       iShowConfidentialMeetingDetails = new QCheckBox( tr( "Show confidential meeting details" ) );
+
+       pgl->addWidget( iShowConfidentialMeetingDetails, 0, 0 );
+
+       privacySettingsGroup->setLayout( pgl );
+       
        // Prepare and set the main layout
        QVBoxLayout *mainLayout = new QVBoxLayout;
        mainLayout->addWidget( userInformationGroup );
        mainLayout->addWidget( serverInformationGroup );
+       mainLayout->addWidget( privacySettingsGroup );
 
        widget->setLayout( mainLayout );
 
@@ -264,7 +275,7 @@ QWidget *SettingsView::initKioskModeTab()
        }
        iPowerSaveStartTime->setTime( Configuration::instance()->startupSettings()->turnOnAt() );
        iPowerSaveEndTime->setTime( Configuration::instance()->startupSettings()->turnOffAt() );
-
+       
        // Prepare the admin password box
        QGroupBox *adminPasswordGroup = new QGroupBox( tr( "Admin Password" ) );
        QLabel *oldPwdLabel = new QLabel( tr( "Old password:" ) );
@@ -338,6 +349,8 @@ void SettingsView::handleOkClicked()
        bool sevenDays = iSevenDays->isChecked();
        bool powerSaveEnabled = iPowerSaveEnabled->isChecked();
 
+       bool showConfidentialMeetingDetails = iShowConfidentialMeetingDetails->isChecked();
+       
        // set values to Configuration
        // set user information
        Configuration::instance()->setUsername(userName);//connectionSettings()->setUsername( userName );
@@ -367,8 +380,15 @@ void SettingsView::handleOkClicked()
        Configuration::instance()->startupSettings()->setTurnOnAt( powerSaveStart );
        Configuration::instance()->startupSettings()->setTurnOffAt( powerSaveEnd );
        
+       // set privacy settings
+       Configuration::instance()->setShowConfidentialMeetingDetails( showConfidentialMeetingDetails );
+       
+       qDebug() << "[SettingsView::okClicked] save()";
+       
        // save configuration
        Configuration::instance()->save();
+
+       qDebug() << "[SettingsView::okClicked] setValues()";
        
        // Emit the signal to notify that ok is pressed and data is saved.
        setValues();
@@ -425,4 +445,7 @@ void SettingsView::setValues()
        }
        iPowerSaveStartTime->setTime( Configuration::instance()->startupSettings()->turnOnAt() );
        iPowerSaveEndTime->setTime( Configuration::instance()->startupSettings()->turnOffAt() );
+       
+       // set privacy settings
+       iShowConfidentialMeetingDetails->setChecked( Configuration::instance()->showConfidentialMeetingDetails() );
 }
index c86e690..923da77 100644 (file)
@@ -90,6 +90,9 @@ private:
        QTimeEdit *iPowerSaveStartTime;
        //! End time for deactivating power save.
        QTimeEdit *iPowerSaveEndTime;
+
+       //! Show confidential meeting details.
+       QCheckBox *iShowConfidentialMeetingDetails;
 };
 
 #endif /*SETTINGSVIEW_H_*/