1 #include "MeetingInfoDialog.h"
11 MeetingInfoDialog::MeetingInfoDialog( Meeting *aMeeting, QWidget *aParent ) :
14 setWindowTitle( tr( "Details" ) );
18 createDialogView( aMeeting );
21 setMinimumWidth( MeetingInfoDialog::width );
22 setMinimumHeight( MeetingInfoDialog::height );
25 MeetingInfoDialog::~MeetingInfoDialog()
29 void MeetingInfoDialog::setMeeting(Meeting *aMeeting)
31 createDialogView( aMeeting );
34 void MeetingInfoDialog::createDialogView(Meeting *aMeeting)
37 normalFont.setPointSize( 11 );
40 boldFont.setPointSize( 11 );
41 boldFont.setBold( true );
43 QLabel *subjectLabel = ToolBox::createLabel( tr( "Subject:" ), boldFont );
44 QLabel *subjectContent = ToolBox::createLabel( aMeeting->subject(), normalFont );
46 QLabel *descriptionLabel = ToolBox::createLabel( tr( "Description:" ), boldFont );
47 QTextEdit *descriptionContent = new QTextEdit( "" );
48 descriptionContent->setHtml( aMeeting->description() );
49 descriptionContent->setReadOnly( true );
50 descriptionContent->setFont( normalFont );
52 QLabel *organizerLabel = NULL;
53 QLabel *organizerContent = NULL;
55 QString roomAddr = aMeeting->room().address();
56 QString organizer = aMeeting->organizer();
57 if( !organizer.contains( roomAddr ) )
59 organizerLabel = ToolBox::createLabel( tr( "Organizer:" ), boldFont );
60 organizerContent = ToolBox::createLabel( aMeeting->organizer(), normalFont );
62 QLabel *startsAtLabel = ToolBox::createLabel( tr( "Starts at:" ), boldFont );
63 QLabel *startsAtContent = ToolBox::createLabel( aMeeting->startsAt().toString( tr( "d MMMM yyyy hh:mm" ) ), normalFont );
65 QLabel *endsAtLabel = ToolBox::createLabel( tr( "Ends at:" ), boldFont );
66 QLabel *endsAtContent = ToolBox::createLabel( aMeeting->endsAt().toString( tr( "d MMMM yyyy hh:mm" ) ), normalFont );
68 QPushButton *button = new QPushButton;
69 button->setText( tr( "OK" ) );
70 connect( button, SIGNAL( clicked() ), this, SLOT( close() ) );
72 QHBoxLayout *buttonLayout = new QHBoxLayout;
73 buttonLayout->addStretch();
74 buttonLayout->addWidget( button );
75 buttonLayout->addStretch();
77 QVBoxLayout *layout = new QVBoxLayout;
78 layout->addWidget( subjectLabel );
79 layout->addWidget( subjectContent );
80 layout->addSpacing( 5 );
81 layout->addWidget( descriptionLabel );
82 layout->addWidget( descriptionContent );
83 layout->addSpacing( 5 );
85 layout->addWidget( organizerLabel );
86 if( organizerContent )
87 layout->addWidget( organizerContent );
88 layout->addSpacing( 5 );
89 layout->addWidget( startsAtLabel );
90 layout->addWidget( startsAtContent );
91 layout->addSpacing( 5 );
92 layout->addWidget( endsAtLabel );
93 layout->addWidget( endsAtContent );
94 layout->addSpacing( 5 );
96 layout->addLayout( buttonLayout );