kivio

kivio_dlg_pageshow.cpp

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program 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
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 #include "kivio_dlg_pageshow.h"
00020 #include "kivio_view.h"
00021 #include "kivio_canvas.h"
00022 #include "kivio_page.h"
00023 #include "kivio_command.h"
00024 #include "kivio_doc.h"
00025 #include "kivio_map.h"
00026 #include <kapplication.h>
00027 #include <klocale.h>
00028 #include <qstringlist.h>
00029 #include <qlayout.h>
00030 #include <kbuttonbox.h>
00031 #include <qstrlist.h>
00032 #include <qptrlist.h>
00033 #include <kdebug.h>
00034 #include <KoTabBar.h>
00035 
00036 KivioPageShow::KivioPageShow( KivioView* parent, const char* name )
00037 : KDialogBase( parent, name, true, i18n("Show Page"), Ok|Cancel, Ok )
00038 {
00039   m_pView = parent;
00040 
00041   QWidget* view = new QWidget(this);
00042   setMainWidget(view);
00043 
00044   QVBoxLayout *lay1 = new QVBoxLayout( view );
00045   lay1->setMargin( KDialog::marginHint() );
00046   lay1->setSpacing( KDialog::spacingHint() );
00047 
00048   QLabel *label = new QLabel( i18n("Select hidden page to show:"), view );
00049   lay1->addWidget( label );
00050 
00051   list = new QListBox(view);
00052   lay1->addWidget( list );
00053 
00054   QStringList tabsList = m_pView->doc()->map()->hiddenPages();
00055   list->insertStringList(tabsList);
00056 
00057   connect( list, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(slotDoubleClicked(QListBoxItem *)));
00058   resize( 200, 150 );
00059 }
00060 
00061 void KivioPageShow::slotDoubleClicked(QListBoxItem *)
00062 {
00063   slotOk();
00064 }
00065 
00066 void KivioPageShow::slotOk()
00067 {
00068   QString text;
00069   if (list->currentItem()!=-1) {
00070     text=list->text(list->currentItem());
00071     //m_pView->tabBar()->showPage(text);
00072     KivioPage * page = m_pView->doc()->map()->findPage( text );
00073     page->setHidden( false );
00074   }
00075   accept();
00076 }
00077 
00078 #include "kivio_dlg_pageshow.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys