kpresenter

KPrPresDurationDia.cpp

00001 // -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
00002 /* This file is part of the KDE project
00003    Copyright (C) 2002 Toshitaka Fujioka <fujioka@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "KPrPresDurationDia.h"
00022 #include "KPrCanvas.h"
00023 #include "KPrPage.h"
00024 #include "KPrDocument.h"
00025 #include <qlabel.h>
00026 #include <qheader.h>
00027 #include <qvbox.h>
00028 #include <qlayout.h>
00029 #include <klistview.h>
00030 #include <kdebug.h>
00031 #include <klocale.h>
00032 
00033 KPrPresDurationDia::KPrPresDurationDia( QWidget *parent, const char *name,
00034                                       KPrDocument *_doc, QStringList _durationListString,
00035                                       const QString &_durationString )
00036     : KDialogBase( parent, name, false, "", KDialogBase::Close ),
00037       doc( _doc )
00038 {
00039     m_durationListString = _durationListString;
00040     m_durationString = _durationString;
00041 
00042     QWidget *page = new QWidget( this );
00043     setMainWidget( page );
00044     QVBoxLayout *topLayout = new QVBoxLayout( page, 2 );
00045 
00046     setupSlideList( page );
00047     topLayout->addWidget( slides );
00048     slides->setSelected( slides->firstChild(), true );
00049 
00050     label = new QLabel( i18n( "Presentation duration: " ) + _durationString, page );
00051     label->setAlignment( AlignVCenter );
00052     topLayout->addWidget( label );
00053 
00054     setMinimumSize( 600, 400 );
00055     connect( this, SIGNAL( closeClicked() ), this, SLOT( slotCloseDialog() ) );
00056 }
00057 
00058 
00059 void KPrPresDurationDia::setupSlideList( QWidget *_page )
00060 {
00061     slides = new KListView( _page );
00062     slides->addColumn( i18n( "No." ) );
00063     slides->addColumn( i18n( "Display Duration" ) );
00064     slides->addColumn( i18n( "Slide Title" ) );
00065     slides->header()->setMovingEnabled( false );
00066     slides->setAllColumnsShowFocus( true );
00067     slides->setRootIsDecorated( false );
00068     slides->setSorting( -1 );
00069 
00070     for ( int i = doc->getPageNums() - 1; i >= 0; --i ) {
00071         if ( doc->pageList().at( i )->isSlideSelected() ) {
00072             KListViewItem *item = new KListViewItem( slides );
00073             item->setPixmap( 0, KPBarIcon( "slide" ) );
00074             item->setText( 0, QString( "%1" ).arg( i + 1 ) );
00075             item->setText( 1, *m_durationListString.at( i ) );
00076             item->setText( 2, doc->pageList().at( i )->pageTitle() );
00077         }
00078     }
00079 }
00080 
00081 #include "KPrPresDurationDia.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys