kivio

kivio_dlg_pageshow.cpp
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19#include "kivio_dlg_pageshow.h"
20#include "kivio_view.h"
21#include "kivio_canvas.h"
22#include "kivio_page.h"
23#include "kivio_command.h"
24#include "kivio_doc.h"
25#include "kivio_map.h"
26#include <tdeapplication.h>
27#include <tdelocale.h>
28#include <tqstringlist.h>
29#include <tqlayout.h>
30#include <kbuttonbox.h>
31#include <tqstrlist.h>
32#include <tqptrlist.h>
33#include <kdebug.h>
34#include <KoTabBar.h>
35
36KivioPageShow::KivioPageShow( KivioView* parent, const char* name )
37: KDialogBase( parent, name, true, i18n("Show Page"), Ok|Cancel, Ok )
38{
39 m_pView = parent;
40
41 TQWidget* view = new TQWidget(this);
42 setMainWidget(view);
43
44 TQVBoxLayout *lay1 = new TQVBoxLayout( view );
45 lay1->setMargin( KDialog::marginHint() );
46 lay1->setSpacing( KDialog::spacingHint() );
47
48 TQLabel *label = new TQLabel( i18n("Select hidden page to show:"), view );
49 lay1->addWidget( label );
50
51 list = new TQListBox(view);
52 lay1->addWidget( list );
53
54 TQStringList tabsList = m_pView->doc()->map()->hiddenPages();
55 list->insertStringList(tabsList);
56
57 connect( list, TQ_SIGNAL(doubleClicked(TQListBoxItem *)), this, TQ_SLOT(slotDoubleClicked(TQListBoxItem *)));
58 resize( 200, 150 );
59}
60
61void KivioPageShow::slotDoubleClicked(TQListBoxItem *)
62{
63 slotOk();
64}
65
66void KivioPageShow::slotOk()
67{
68 TQString text;
69 if (list->currentItem()!=-1) {
70 text=list->text(list->currentItem());
71 //m_pView->tabBar()->showPage(text);
72 KivioPage * page = m_pView->doc()->map()->findPage( text );
73 page->setHidden( false );
74 }
75 accept();
76}
77
78#include "kivio_dlg_pageshow.moc"