~ubuntu-branches/debian/sid/kexi/sid

« back to all changes in this revision

Viewing changes to src/mobile/KexiMobileWidget.cpp

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2017-06-24 20:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20170624201010-5lrzd5r2vwthwifp
Tags: upstream-3.0.1.1
ImportĀ upstreamĀ versionĀ 3.0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**  This file is part of the KDE project
 
2
 *
 
3
 *  Copyright (C) 2011 Adam Pigg <adam@piggz.co.uk>
 
4
 *
 
5
 *  This library is free software; you can redistribute it and/or
 
6
 *  modify it under the terms of the GNU Library General Public
 
7
 *  License as published by the Free Software Foundation; either
 
8
 *  version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 *  This library 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 GNU
 
13
 *  Library General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU Library General Public License
 
16
 *  along with this library; see the file COPYING.LIB.  If not, write to
 
17
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 *  Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#include "KexiMobileWidget.h"
 
22
#include "KexiMobileNavigator.h"
 
23
 
 
24
#include <core/KexiWindow.h>
 
25
 
 
26
#include <QDebug>
 
27
 
 
28
KexiMobileWidget::KexiMobileWidget(KexiProject* p) : m_project(p), m_navWidget(0), m_objectPage(0)
 
29
{
 
30
    m_navWidget = new KexiMobileNavigator();
 
31
    addWidget(m_navWidget);
 
32
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
33
}
 
34
 
 
35
KexiMobileWidget::~KexiMobileWidget()
 
36
{
 
37
 
 
38
}
 
39
 
 
40
KexiMobileNavigator* KexiMobileWidget::navigator()
 
41
{
 
42
    return m_navWidget;
 
43
}
 
44
 
 
45
void KexiMobileWidget::showNavigator()
 
46
{
 
47
    if (currentWidget() != m_navWidget) {
 
48
        setCurrentWidget(m_navWidget);
 
49
    }
 
50
}
 
51
 
 
52
 
 
53
void KexiMobileWidget::databaseOpened(KexiProject *project)
 
54
{
 
55
    m_project = project;
 
56
    if (project && (project->open() == true)) {
 
57
        m_navWidget->setProject(project);
 
58
        qDebug() << "Project opened";
 
59
    } else {
 
60
        qWarning() << "Project not opened";
 
61
        if (project) {
 
62
            qWarning() << project->errorMsg();
 
63
        }
 
64
    }
 
65
 
 
66
    setCurrentWidget(m_navWidget);
 
67
}
 
68
 
 
69
KexiWindow* KexiMobileWidget::activeObject()
 
70
{
 
71
    return m_objectPage;
 
72
}
 
73
 
 
74
void KexiMobileWidget::setActiveObject(KexiWindow* win)
 
75
{
 
76
    removeWidget(m_objectPage);
 
77
 
 
78
    if (win != m_objectPage) {
 
79
        delete m_objectPage;
 
80
    }
 
81
    m_objectPage = win;
 
82
 
 
83
    addWidget(m_objectPage);
 
84
 
 
85
    setCurrentWidget(m_objectPage);
 
86
}
 
87