summaryrefslogtreecommitdiffstats
path: root/kivio/kiviopart/kivio_dlg_pageshow.cpp
blob: 7989a4c6ef4fc6c3a37155f960f6e7e555e56054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Kivio - Visual Modelling and Flowcharting
 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
#include "kivio_dlg_pageshow.h"
#include "kivio_view.h"
#include "kivio_canvas.h"
#include "kivio_page.h"
#include "kivio_command.h"
#include "kivio_doc.h"
#include "kivio_map.h"
#include <kapplication.h>
#include <klocale.h>
#include <tqstringlist.h>
#include <layout.h>
#include <kbuttonbox.h>
#include <tqstrlist.h>
#include <tqptrlist.h>
#include <kdebug.h>
#include <KoTabBar.h>

KivioPageShow::KivioPageShow( KivioView* parent, const char* name )
: KDialogBase( parent, name, true, i18n("Show Page"), Ok|Cancel, Ok )
{
  m_pView = parent;

  TQWidget* view = new TQWidget(this);
  setMainWidget(view);

  TQVBoxLayout *lay1 = new TQVBoxLayout( view );
  lay1->setMargin( KDialog::marginHint() );
  lay1->setSpacing( KDialog::spacingHint() );

  TQLabel *label = new TQLabel( i18n("Select hidden page to show:"), view );
  lay1->addWidget( label );

  list = new TQListBox(view);
  lay1->addWidget( list );

  TQStringList tabsList = m_pView->doc()->map()->hiddenPages();
  list->insertStringList(tabsList);

  connect( list, TQT_SIGNAL(doubleClicked(TQListBoxItem *)), this, TQT_SLOT(slotDoubleClicked(TQListBoxItem *)));
  resize( 200, 150 );
}

void KivioPageShow::slotDoubleClicked(TQListBoxItem *)
{
  slotOk();
}

void KivioPageShow::slotOk()
{
  TQString text;
  if (list->currentItem()!=-1) {
    text=list->text(list->currentItem());
    //m_pView->tabBar()->showPage(text);
    KivioPage * page = m_pView->doc()->map()->findPage( text );
    page->setHidden( false );
  }
  accept();
}

#include "kivio_dlg_pageshow.moc"