~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to src/toresultcombo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2009-04-07 13:16:05 UTC
  • mfrom: (1.2.7 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090407131605-u422yigfv7jgg0l0
Tags: 2.0.0-3
* Cleaned up packaging a little bit.
* Added homepage information to control file.
* Bumped Standards-Version to 3.8.1.
* Released to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****
2
 
*
3
 
* TOra - An Oracle Toolkit for DBA's and developers
4
 
* Copyright (C) 2003-2005 Quest Software, Inc
5
 
* Portions Copyright (C) 2005 Other Contributors
6
 
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License
9
 
* as published by the Free Software Foundation;  only version 2 of
10
 
* the License is valid for this program.
11
 
12
 
* This program is distributed in the hope that it will be useful,
13
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
* GNU General Public License for more details.
16
 
17
 
* You should have received a copy of the GNU General Public License
18
 
* along with this program; if not, write to the Free Software
19
 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 
*
21
 
*      As a special exception, you have permission to link this program
22
 
*      with the Oracle Client libraries and distribute executables, as long
23
 
*      as you follow the requirements of the GNU GPL in regard to all of the
24
 
*      software in the executable aside from Oracle client libraries.
25
 
*
26
 
*      Specifically you are not permitted to link this program with the
27
 
*      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
28
 
*      And you are not permitted to distribute binaries compiled against
29
 
*      these libraries without written consent from Quest Software, Inc.
30
 
*      Observe that this does not disallow linking to the Qt Free Edition.
31
 
*
32
 
*      You may link this product with any GPL'd Qt library such as Qt/Free
33
 
*
34
 
* All trademarks belong to their respective owners.
35
 
*
36
 
*****/
 
1
 
 
2
/* BEGIN_COMMON_COPYRIGHT_HEADER
 
3
 *
 
4
 * TOra - An Oracle Toolkit for DBA's and developers
 
5
 * 
 
6
 * Shared/mixed copyright is held throughout files in this product
 
7
 * 
 
8
 * Portions Copyright (C) 2000-2001 Underscore AB
 
9
 * Portions Copyright (C) 2003-2005 Quest Software, Inc.
 
10
 * Portions Copyright (C) 2004-2008 Numerous Other Contributors
 
11
 * 
 
12
 * This program is free software; you can redistribute it and/or
 
13
 * modify it under the terms of the GNU General Public License
 
14
 * as published by the Free Software Foundation;  only version 2 of
 
15
 * the License is valid for this program.
 
16
 * 
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 * 
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; if not, write to the Free Software
 
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
25
 * 
 
26
 *      As a special exception, you have permission to link this program
 
27
 *      with the Oracle Client libraries and distribute executables, as long
 
28
 *      as you follow the requirements of the GNU GPL in regard to all of the
 
29
 *      software in the executable aside from Oracle client libraries.
 
30
 * 
 
31
 *      Specifically you are not permitted to link this program with the
 
32
 *      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
 
33
 *      And you are not permitted to distribute binaries compiled against
 
34
 *      these libraries. 
 
35
 * 
 
36
 *      You may link this product with any GPL'd Qt library.
 
37
 * 
 
38
 * All trademarks belong to their respective owners.
 
39
 *
 
40
 * END_COMMON_COPYRIGHT_HEADER */
37
41
 
38
42
#include "utils.h"
39
43
 
44
48
#include "tosql.h"
45
49
#include "totool.h"
46
50
 
47
 
#include "toresultcombo.moc"
48
51
 
49
52
toResultCombo::toResultCombo(QWidget *parent, const char *name)
50
 
        : QComboBox(parent, name), Query(0)
 
53
        : QComboBox(parent), Query(0)
51
54
{
 
55
    setObjectName(name);
52
56
    connect(&Poll, SIGNAL(timeout()), this, SLOT(poll()));
53
57
    connect(this, SIGNAL(activated(int)),
54
58
            this, SLOT(changeSelected(void)));
 
59
    setSizeAdjustPolicy(QComboBox::AdjustToContents);
55
60
}
56
61
 
57
62
toResultCombo::~toResultCombo()
58
 
{    
 
63
{
59
64
}
60
65
 
61
66
void toResultCombo::query(const QString &sql, const toQList &param)
66
71
    try
67
72
    {
68
73
        clear();
69
 
        insertStringList(Additional);
70
 
        for (unsigned int i = 0;i < Additional.count();i++)
 
74
        addItems(Additional);
 
75
        for (int i = 0;i < Additional.count();i++)
71
76
            if (Additional[i] == Selected)
72
 
                setCurrentItem(i);
 
77
                setCurrentIndex(i);
73
78
 
74
79
        Query = new toNoBlockQuery(connection(), toQuery::Background, sql, param);
75
80
        Poll.start(100);
93
98
            while (Query->poll() && !Query->eof())
94
99
            {
95
100
                QString t = Query->readValue();
96
 
                insertItem(t);
 
101
                addItem(t);
97
102
                if (t == Selected)
98
 
                    setCurrentItem(count() - 1);
 
103
                    setCurrentIndex(count() - 1);
99
104
            }
100
105
 
101
106
            if (Query->eof())