1 #include "MeetingInfoDialog.h"
6 #include "Configuration.h"
10 #include <QPushButton>
14 MeetingInfoDialog::MeetingInfoDialog( Meeting *aMeeting, QWidget *aParent ) :
17 setWindowTitle( tr( "Details" ) );
21 createDialogView( aMeeting );
24 setMinimumWidth( MeetingInfoDialog::width );
25 setMinimumHeight( MeetingInfoDialog::height );
28 MeetingInfoDialog::~MeetingInfoDialog()
32 void MeetingInfoDialog::setMeeting(Meeting *aMeeting)
34 createDialogView( aMeeting );
37 void MeetingInfoDialog::createDialogView(Meeting *aMeeting)
39 qDebug() << "[MeetingInfoDialog::createDialogView] <Invoked>";
42 normalFont.setPointSize( 11 );
45 boldFont.setPointSize( 11 );
46 boldFont.setBold( true );
48 QLabel *subjectLabel = ToolBox::createLabel( tr( "Subject:" ), boldFont );
49 QLabel *subjectContent = new QLabel();
50 subjectContent->setFont( normalFont );
52 QLabel *descriptionLabel = ToolBox::createLabel( tr( "Description:" ), boldFont );
53 QTextEdit *descriptionContent = new QTextEdit( "" );
55 if( Configuration::instance()->showConfidentialMeetingDetails() )
57 subjectContent->setText( aMeeting->subject() );
58 descriptionContent->setHtml( aMeeting->description() );
61 if( subjectContent->text().isEmpty() )
63 subjectContent->setText( tr( "Room reserved", "Meeting Info Subject" ) ); // default subject text
66 qDebug() << "############ Desc: " << descriptionContent->toPlainText().trimmed();
68 if( descriptionContent->toPlainText().trimmed().isEmpty() )
70 descriptionContent->setPlainText( tr( "Room reserved", "Meeting Info Description" ) ); // default description text
73 descriptionContent->setReadOnly( true );
74 descriptionContent->setFont( normalFont );
76 QLabel *organizerLabel = NULL;
77 QLabel *organizerContent = NULL;
79 QString roomAddr = aMeeting->room().address();
80 QString organizer = aMeeting->organizer();
81 if( !organizer.contains( roomAddr ) )
83 organizerLabel = ToolBox::createLabel( tr( "Organizer:" ), boldFont );
84 organizerContent = ToolBox::createLabel( aMeeting->organizer(), normalFont );
86 QLabel *startsAtLabel = ToolBox::createLabel( tr( "Starts at:" ), boldFont );
87 QLabel *startsAtContent = ToolBox::createLabel( aMeeting->startsAt().toString( tr( "d MMMM yyyy hh:mm" ) ), normalFont );
89 QLabel *endsAtLabel = ToolBox::createLabel( tr( "Ends at:" ), boldFont );
90 QLabel *endsAtContent = ToolBox::createLabel( aMeeting->endsAt().toString( tr( "d MMMM yyyy hh:mm" ) ), normalFont );
92 QPushButton *button = new QPushButton;
93 button->setText( tr( "OK" ) );
94 connect( button, SIGNAL( clicked() ), this, SLOT( close() ) );
96 QHBoxLayout *buttonLayout = new QHBoxLayout;
97 buttonLayout->addStretch();
98 buttonLayout->addWidget( button );
99 buttonLayout->addStretch();
101 QVBoxLayout *layout = new QVBoxLayout;
102 layout->addWidget( subjectLabel );
103 layout->addWidget( subjectContent );
104 layout->addSpacing( 5 );
105 layout->addWidget( descriptionLabel );
106 layout->addWidget( descriptionContent );
107 layout->addSpacing( 5 );
109 layout->addWidget( organizerLabel );
110 if( organizerContent )
111 layout->addWidget( organizerContent );
112 layout->addSpacing( 5 );
113 layout->addWidget( startsAtLabel );
114 layout->addWidget( startsAtContent );
115 layout->addSpacing( 5 );
116 layout->addWidget( endsAtLabel );
117 layout->addWidget( endsAtContent );
118 layout->addSpacing( 5 );
119 layout->addStretch();
120 layout->addLayout( buttonLayout );
123 qDebug() << "[MeetingInfoDialog::createDialogView] <Finished>";