~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to kdevdesigner/designer/editfunctionsimpl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
 
3
**
 
4
** This file is part of Qt Designer.
 
5
**
 
6
** This file may be distributed and/or modified under the terms of the
 
7
** GNU General Public License version 2 as published by the Free Software
 
8
** Foundation and appearing in the file LICENSE.GPL included in the
 
9
** packaging of this file.
 
10
**
 
11
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
 
12
** licenses may use this file in accordance with the Qt Commercial License
 
13
** Agreement provided with the Software.
 
14
**
 
15
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
16
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
17
**
 
18
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
19
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
20
**   information about Qt Commercial License Agreements.
 
21
**
 
22
** Contact info@trolltech.com if any conditions of this licensing are
 
23
** not clear to you.
 
24
**
 
25
**********************************************************************/
 
26
 
 
27
#include "editfunctionsimpl.h"
 
28
#include "formwindow.h"
 
29
#include "metadatabase.h"
 
30
#include "asciivalidator.h"
 
31
#include "mainwindow.h"
 
32
#include "hierarchyview.h"
 
33
#include "project.h"
 
34
 
 
35
#include <kiconloader.h>
 
36
#include "kdevdesigner_part.h"
 
37
#include <kdebug.h>
 
38
 
 
39
#include <qlistview.h>
 
40
#include <qpushbutton.h>
 
41
#include <qlineedit.h>
 
42
#include <qcombobox.h>
 
43
#include <qstrlist.h>
 
44
#include <qmessagebox.h>
 
45
#include <qlayout.h>
 
46
#include <qlabel.h>
 
47
#include <qgroupbox.h>
 
48
#include <qheader.h>
 
49
#include <qcheckbox.h>
 
50
 
 
51
#include <klocale.h>
 
52
 
 
53
EditFunctions::EditFunctions( QWidget *parent, FormWindow *fw, bool justSlots )
 
54
    : EditFunctionsBase( parent, 0, TRUE ), formWindow( fw )
 
55
{
 
56
    connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) );
 
57
 
 
58
    id = 0;
 
59
    functList.clear();
 
60
 
 
61
    QValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( fw );
 
62
    for ( QValueList<MetaDataBase::Function>::Iterator it = functionList.begin(); it != functionList.end(); ++it ) {
 
63
        QListViewItem *i = new QListViewItem( functionListView );
 
64
 
 
65
        i->setPixmap( 0, SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()) );
 
66
        i->setText( 0, (*it).function );
 
67
        i->setText( 1, (*it).returnType );
 
68
        i->setText( 2, (*it).specifier );
 
69
        i->setText( 3, (*it).access  );
 
70
        i->setText( 4, (*it).type );
 
71
 
 
72
        FunctItem fui;
 
73
        fui.id = id;
 
74
        fui.oldName = (*it).function;
 
75
        fui.newName = fui.oldName;
 
76
        fui.oldRetTyp = (*it).returnType;
 
77
        fui.retTyp = fui.oldRetTyp;
 
78
        fui.oldSpec = (*it).specifier;
 
79
        fui.spec = fui.oldSpec;
 
80
        fui.oldAccess = (*it).access;
 
81
        fui.access = fui.oldAccess;
 
82
        fui.oldType = (*it).type;
 
83
        fui.type = fui.oldType;
 
84
        functList.append( fui );
 
85
 
 
86
        functionIds.insert( i, id );
 
87
        id++;
 
88
 
 
89
        if ( (*it).type == "slot" ) {
 
90
            if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( (*it).function ).latin1() ) )
 
91
                i->setText( 5, i18n( "Yes" ) );
 
92
            else
 
93
                i->setText( 5, i18n( "No" ) );
 
94
        } else {
 
95
            i->setText( 5, "---" );
 
96
        }
 
97
    }
 
98
 
 
99
    boxProperties->setEnabled( FALSE );
 
100
    functionName->setValidator( new AsciiValidator( TRUE, functionName ) );
 
101
 
 
102
    if ( functionListView->firstChild() )
 
103
        functionListView->setCurrentItem( functionListView->firstChild() );
 
104
 
 
105
    showOnlySlots->setChecked( justSlots );
 
106
    lastType = "function";
 
107
 
 
108
    // Enable rename for all QListViewItems
 
109
    QListViewItemIterator lvit = functionListView->firstChild();
 
110
    for ( ; *lvit; lvit++ )
 
111
        (*lvit)->setRenameEnabled( 0, TRUE );
 
112
 
 
113
    // Connect listview signal to signal-relay
 
114
    QObject::connect( functionListView,
 
115
                      SIGNAL( itemRenamed( QListViewItem*, int, const QString & ) ),
 
116
                      this,
 
117
                      SLOT( emitItemRenamed(QListViewItem*, int, const QString&) ) );
 
118
 
 
119
    // Connect signal-relay to QLineEdit "functionName"
 
120
    QObjectList *l = parent->queryList( "QLineEdit", "functionName" );
 
121
    QObject *obj;
 
122
    QObjectListIt itemsLineEditIt( *l );
 
123
    while ( (obj = itemsLineEditIt.current()) != 0 ) {
 
124
        ++itemsLineEditIt;
 
125
        QObject::connect( this,
 
126
                          SIGNAL( itemRenamed( const QString & ) ),
 
127
                          obj,
 
128
                          SLOT( setText( const QString & ) ) );
 
129
    }
 
130
    delete l;
 
131
 
 
132
        functionSpecifier->insertItem( "non virtual" );
 
133
        functionSpecifier->insertItem( "virtual" );
 
134
        functionSpecifier->insertItem( "pure virtual" );
 
135
        functionSpecifier->insertItem( "static" );
 
136
        
 
137
        functionAccess->insertItem( "public" );
 
138
        functionAccess->insertItem( "protected" );
 
139
        functionAccess->insertItem( "private" );
 
140
        
 
141
        functionType->insertItem( "slot" );
 
142
        functionType->insertItem( "function" );
 
143
 
 
144
}
 
145
 
 
146
void EditFunctions::okClicked()
 
147
{
 
148
    QValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( formWindow );
 
149
    QString n = i18n( "Add/Remove functions of '%1'" ).arg( formWindow->name() );
 
150
    QPtrList<Command> commands;
 
151
    QValueList<MetaDataBase::Function>::Iterator fit;
 
152
    if ( !functionList.isEmpty() ) {
 
153
        for ( fit = functionList.begin(); fit != functionList.end(); ++fit ) {
 
154
            bool functionFound = FALSE;
 
155
            QValueList<FunctItem>::Iterator it = functList.begin();
 
156
            for ( ; it != functList.end(); ++it ) {
 
157
                if ( MetaDataBase::normalizeFunction( (*it).oldName ) ==
 
158
                     MetaDataBase::normalizeFunction( (*fit).function ) ) {
 
159
                    functionFound = TRUE;
 
160
                    break;
 
161
                }
 
162
            }
 
163
            if ( !functionFound )
 
164
                commands.append( new RemoveFunctionCommand( i18n( "Remove Function" ),
 
165
                                                            formWindow, (*fit).function, (*fit).specifier,
 
166
                                                            (*fit).access,
 
167
                                                            (*fit).type,
 
168
                                                            formWindow->project()->language(),
 
169
                                                            (*fit).returnType ) );
 
170
        }
 
171
    }
 
172
 
 
173
    bool invalidFunctions = FALSE;
 
174
    QValueList<FunctItem> invalidItems;
 
175
 
 
176
    if ( !functList.isEmpty() ) {
 
177
        QStrList lst;
 
178
        QValueList<FunctItem>::Iterator it = functList.begin();
 
179
        for ( ; it != functList.end(); ++it ) {
 
180
            MetaDataBase::Function function;
 
181
            function.function = (*it).newName;
 
182
            function.returnType = (*it).retTyp;
 
183
            function.specifier = (*it).spec;
 
184
            function.access = (*it).access;
 
185
            function.type = (*it).type;
 
186
            function.language = formWindow->project()->language();
 
187
            if ( function.returnType.isEmpty() )
 
188
                function.returnType = "void";
 
189
            QString s = function.function;
 
190
            s = s.simplifyWhiteSpace();
 
191
            bool startNum = s[ 0 ] >= '0' && s[ 0 ] <= '9';
 
192
            bool noParens = s.contains( '(' ) != 1 || s.contains( ')' ) != 1;
 
193
            bool illegalSpace = s.find( ' ' ) != -1 && s.find( ' ' ) < s.find( '(' );
 
194
 
 
195
            if ( startNum || noParens || illegalSpace || lst.find( function.function ) != -1 ) {
 
196
                invalidFunctions = TRUE;
 
197
                invalidItems.append( (*it) );
 
198
                continue;
 
199
            }
 
200
            bool functionFound = FALSE;
 
201
            for ( fit = functionList.begin(); fit != functionList.end(); ++fit ) {
 
202
                if ( MetaDataBase::normalizeFunction( (*fit).function ) ==
 
203
                     MetaDataBase::normalizeFunction( (*it).oldName ) ) {
 
204
                    functionFound = TRUE;
 
205
                    break;
 
206
                }
 
207
            }
 
208
            if ( !functionFound )
 
209
                commands.append( new AddFunctionCommand( i18n( "Add Function" ),
 
210
                                                        formWindow, function.function, function.specifier,
 
211
                                                        function.access,
 
212
                                                        function.type, formWindow->project()->language(),
 
213
                                                        function.returnType ) );
 
214
            if ( MetaDataBase::normalizeFunction( (*it).newName ) != MetaDataBase::normalizeFunction( (*it).oldName ) ||
 
215
                 (*it).spec != (*it).oldSpec || (*it).access != (*it).oldAccess || (*it).type != (*it).oldType ||
 
216
                 (*it).retTyp != (*it).oldRetTyp ) {
 
217
                QString normalizedOldName = MetaDataBase::normalizeFunction( (*it).oldName );
 
218
                if ((*it).oldName.endsWith("const")) // make sure we get the 'const' when we remove the old name
 
219
                    normalizedOldName += " const";
 
220
                commands.append( new ChangeFunctionAttribCommand( i18n( "Change Function Attributes" ),
 
221
                                                                  formWindow, function, normalizedOldName,
 
222
                                                                  (*it).oldSpec, (*it).oldAccess, (*it).oldType,
 
223
                                                                  formWindow->project()->language(), (*it).oldRetTyp ) );
 
224
            }
 
225
            lst.append( function.function );
 
226
        }
 
227
    }
 
228
 
 
229
    if ( invalidFunctions ) {
 
230
        if ( QMessageBox::information( this, i18n( "Edit Functions" ),
 
231
                                       i18n( "Some syntactically incorrect functions have been defined.\n"
 
232
                                       "Remove these functions?" ), i18n( "&Yes" ), i18n( "&No" ) ) == 0 ) {
 
233
            QValueList<FunctItem>::Iterator it = functList.begin();
 
234
            while ( it != functList.end() ) {
 
235
                bool found = FALSE;
 
236
                QValueList<FunctItem>::Iterator vit = invalidItems.begin();
 
237
                for ( ; vit != invalidItems.end(); ++vit ) {
 
238
                    if ( (*vit).newName == (*it).newName ) {
 
239
                        invalidItems.remove( vit );
 
240
                        found = TRUE;
 
241
                        break;
 
242
                    }
 
243
                }
 
244
                if ( found ) {
 
245
                    int delId = (*it).id;
 
246
                    it = functList.remove( it );
 
247
                    QMap<QListViewItem*, int>::Iterator fit = functionIds.begin();
 
248
                    while ( fit != functionIds.end() ) {
 
249
                        if ( *fit == delId ) {
 
250
                            QListViewItem *litem = fit.key();
 
251
                            functionIds.remove( fit );
 
252
                            delete litem;
 
253
                            if ( functionListView->currentItem() )
 
254
                                functionListView->setSelected( functionListView->currentItem(), TRUE );
 
255
                            currentItemChanged( functionListView->currentItem() );
 
256
                            break;
 
257
                        }
 
258
                        ++fit;
 
259
                    }
 
260
                }
 
261
                else
 
262
                    ++it;
 
263
            }
 
264
            if ( functionListView->firstChild() ) {
 
265
                functionListView->setCurrentItem( functionListView->firstChild() );
 
266
                functionListView->setSelected( functionListView->firstChild(), TRUE );
 
267
            }
 
268
        }
 
269
        formWindow->mainWindow()->objectHierarchy()->updateFormDefinitionView();
 
270
        return;
 
271
    }
 
272
 
 
273
    if ( !commands.isEmpty() ) {
 
274
        MacroCommand *cmd = new MacroCommand( n, formWindow, commands );
 
275
        formWindow->commandHistory()->addCommand( cmd );
 
276
        cmd->execute();
 
277
    }
 
278
 
 
279
    formWindow->mainWindow()->objectHierarchy()->updateFormDefinitionView();
 
280
    accept();
 
281
}
 
282
 
 
283
void EditFunctions::functionAdd( const QString &access, const QString &type )
 
284
{
 
285
    QListViewItem *i = new QListViewItem( functionListView );
 
286
    i->setPixmap( 0, SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()) );
 
287
    i->setRenameEnabled( 0, TRUE );
 
288
    i->setText( 1, "void" );
 
289
    i->setText( 2, "virtual" );
 
290
 
 
291
    if ( access.isEmpty() )
 
292
        i->setText( 3, "public" );
 
293
    else
 
294
        i->setText( 3, access );
 
295
 
 
296
    if( type.isEmpty() ) {
 
297
        if ( showOnlySlots->isChecked() )
 
298
            i->setText( 4, "slot" );
 
299
        else {
 
300
            i->setText( 4, lastType );
 
301
        }
 
302
    } else {
 
303
        i->setText( 4, type );
 
304
    }
 
305
 
 
306
    if ( i->text( 4 ) == "slot" ) {
 
307
        i->setText( 0, "newSlot()" );
 
308
        if ( MetaDataBase::isSlotUsed( formWindow, "newSlot()" ) )
 
309
            i->setText( 5, i18n( "Yes" ) );
 
310
        else
 
311
            i->setText( 5, i18n( "No" ) );
 
312
    } else {
 
313
        i->setText( 0, "newFunction()" );
 
314
        i->setText( 5, "---" );
 
315
    }
 
316
 
 
317
    functionListView->setCurrentItem( i );
 
318
    functionListView->setSelected( i, TRUE );
 
319
    functionListView->ensureItemVisible( i );
 
320
    functionName->setFocus();
 
321
    functionName->selectAll();
 
322
 
 
323
    FunctItem fui;
 
324
    fui.id = id;
 
325
    fui.oldName = i->text( 0 );
 
326
    fui.newName = fui.oldName;
 
327
    fui.oldRetTyp = i->text( 1 );
 
328
    fui.retTyp = fui.oldRetTyp;
 
329
    fui.oldSpec = i->text ( 2 );
 
330
    fui.spec = fui.oldSpec;
 
331
    fui.oldAccess = i->text( 3 );
 
332
    fui.access = fui.oldAccess;
 
333
    fui.oldType = i->text( 4 );
 
334
    fui.type = fui.oldType;
 
335
    lastType = fui.oldType;
 
336
    functList.append( fui );
 
337
    functionIds.insert( i, id );
 
338
    id++;
 
339
}
 
340
 
 
341
void EditFunctions::functionRemove()
 
342
{
 
343
    if ( !functionListView->currentItem() )
 
344
        return;
 
345
 
 
346
    functionListView->blockSignals( TRUE );
 
347
    removedFunctions << MetaDataBase::normalizeFunction( functionListView->currentItem()->text( 0 ) );
 
348
    int delId = functionIds[ functionListView->currentItem() ];
 
349
    QValueList<FunctItem>::Iterator it = functList.begin();
 
350
    while ( it != functList.end() ) {
 
351
        if ( (*it).id == delId ) {
 
352
            functList.remove( it );
 
353
            break;
 
354
        }
 
355
        ++it;
 
356
    }
 
357
    functionIds.remove( functionListView->currentItem() );
 
358
    delete functionListView->currentItem();
 
359
    if ( functionListView->currentItem() )
 
360
        functionListView->setSelected( functionListView->currentItem(), TRUE );
 
361
    functionListView->blockSignals( FALSE );
 
362
    currentItemChanged( functionListView->currentItem() );
 
363
}
 
364
 
 
365
void EditFunctions::currentItemChanged( QListViewItem *i )
 
366
{
 
367
    functionName->blockSignals( TRUE );
 
368
    functionName->setText( "" );
 
369
    functionAccess->setCurrentItem( 0 );
 
370
    functionName->blockSignals( FALSE );
 
371
 
 
372
    if ( !i ) {
 
373
        boxProperties->setEnabled( FALSE );
 
374
        return;
 
375
    }
 
376
 
 
377
    functionName->blockSignals( TRUE );
 
378
    functionName->setText( i->text( 0 ) );
 
379
    editType->setText( i->text( 1 ) );
 
380
    QString specifier = i->text( 2 );
 
381
    QString access = i->text( 3 );
 
382
    QString type = i->text( 4 );
 
383
    if ( specifier == "pure virtual" )
 
384
        functionSpecifier->setCurrentItem( 2 );
 
385
    else if ( specifier == "non virtual" )
 
386
        functionSpecifier->setCurrentItem( 0 );
 
387
    else if ( specifier == "virtual" )
 
388
        functionSpecifier->setCurrentItem( 1 );
 
389
    else
 
390
        functionSpecifier->setCurrentItem( 3 );
 
391
    if ( access == "private" )
 
392
        functionAccess->setCurrentItem( 2 );
 
393
    else if ( access == "protected" )
 
394
        functionAccess->setCurrentItem( 1 );
 
395
    else
 
396
        functionAccess->setCurrentItem( 0 );
 
397
    if ( type == "slot" )
 
398
        functionType->setCurrentItem( 0 );
 
399
    else
 
400
        functionType->setCurrentItem( 1 );
 
401
 
 
402
    functionName->blockSignals( FALSE );
 
403
    boxProperties->setEnabled( TRUE );
 
404
}
 
405
 
 
406
void EditFunctions::currentTextChanged( const QString &txt )
 
407
{
 
408
    if ( !functionListView->currentItem() )
 
409
        return;
 
410
 
 
411
    changeItem( functionListView->currentItem(), Name, txt );
 
412
    functionListView->currentItem()->setText( 0, txt );
 
413
 
 
414
    if ( functionListView->currentItem()->text( 4 ) == "slot" ) {
 
415
        if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( txt.latin1() ).latin1() ) )
 
416
            functionListView->currentItem()->setText( 5, i18n( "Yes" ) );
 
417
        else
 
418
            functionListView->currentItem()->setText( 5, i18n( "No" ) );
 
419
    } else {
 
420
        functionListView->currentItem()->setText( 5, "---" );
 
421
    }
 
422
}
 
423
 
 
424
void EditFunctions::currentSpecifierChanged( const QString& s )
 
425
{
 
426
    if ( !functionListView->currentItem() )
 
427
        return;
 
428
 
 
429
    changeItem( functionListView->currentItem(), Specifier, s );
 
430
    functionListView->currentItem()->setText( 2, s );
 
431
}
 
432
 
 
433
void EditFunctions::currentAccessChanged( const QString& a )
 
434
{
 
435
    if ( !functionListView->currentItem() )
 
436
        return;
 
437
    changeItem( functionListView->currentItem(), Access, a );
 
438
    functionListView->currentItem()->setText( 3, a );
 
439
}
 
440
 
 
441
 
 
442
void EditFunctions::currentReturnTypeChanged( const QString &type )
 
443
{
 
444
    if ( !functionListView->currentItem() )
 
445
        return;
 
446
    changeItem( functionListView->currentItem(), ReturnType, type );
 
447
    functionListView->currentItem()->setText( 1, type );
 
448
}
 
449
 
 
450
void EditFunctions::currentTypeChanged( const QString &type )
 
451
{
 
452
    if ( !functionListView->currentItem() )
 
453
        return;
 
454
    changeItem( functionListView->currentItem(), Type,  type );
 
455
    lastType = type;
 
456
    functionListView->currentItem()->setText( 4, type );
 
457
    if ( type == "slot" ) {
 
458
        if ( MetaDataBase::isSlotUsed( formWindow,
 
459
                MetaDataBase::normalizeFunction( functionListView->currentItem()->text( 0 ).latin1() ).latin1() ) )
 
460
            functionListView->currentItem()->setText( 5, i18n( "Yes" ) );
 
461
        else
 
462
            functionListView->currentItem()->setText( 5, i18n( "No" ) );
 
463
    } else {
 
464
        functionListView->currentItem()->setText( 5, "---" );
 
465
    }
 
466
}
 
467
 
 
468
void EditFunctions::changeItem( QListViewItem *item, Attribute a, const QString &nV )
 
469
{
 
470
    int itemId;
 
471
    QMap<QListViewItem*, int>::Iterator fit = functionIds.find( item );
 
472
    if ( fit != functionIds.end() )
 
473
        itemId = *fit;
 
474
    else
 
475
        return;
 
476
 
 
477
    QValueList<FunctItem>::Iterator it = functList.begin();
 
478
    for ( ; it != functList.end(); ++it ) {
 
479
        if ( (*it).id == itemId ) {
 
480
            switch( a ) {
 
481
                case Name:
 
482
                    (*it).newName = nV;
 
483
                    break;
 
484
                case Specifier:
 
485
                    (*it).spec = nV;
 
486
                    break;
 
487
                case Access:
 
488
                    (*it).access = nV;
 
489
                    break;
 
490
                case ReturnType:
 
491
                    (*it).retTyp = nV;
 
492
                    break;
 
493
                case Type:
 
494
                    (*it).type = nV;
 
495
                    break;
 
496
            }
 
497
        }
 
498
    }
 
499
}
 
500
 
 
501
void EditFunctions::setCurrentFunction( const QString &function )
 
502
{
 
503
    QListViewItemIterator it( functionListView );
 
504
    while ( it.current() ) {
 
505
        if ( MetaDataBase::normalizeFunction( it.current()->text( 0 ) ) == function ) {
 
506
            functionListView->setCurrentItem( it.current() );
 
507
            functionListView->setSelected( it.current(), TRUE );
 
508
            currentItemChanged( it.current() );
 
509
            return;
 
510
        }
 
511
        ++it;
 
512
    }
 
513
}
 
514
 
 
515
void EditFunctions::displaySlots( bool justSlots )
 
516
{
 
517
    functionIds.clear();
 
518
    functionListView->clear();
 
519
    for ( QValueList<FunctItem>::Iterator it = functList.begin(); it != functList.end(); ++it ) {
 
520
        if ( (*it).type == "function" && justSlots )
 
521
            continue;
 
522
        QListViewItem *i = new QListViewItem( functionListView );
 
523
        functionIds.insert( i, (*it).id );
 
524
        i->setPixmap( 0, SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()) );
 
525
        i->setText( 0, (*it).newName );
 
526
        i->setText( 1, (*it).retTyp );
 
527
        i->setText( 2, (*it).spec );
 
528
        i->setText( 3, (*it).access  );
 
529
        i->setText( 4, (*it).type );
 
530
 
 
531
        if ( (*it).type == "slot" ) {
 
532
            if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( (*it).newName ).latin1() ) )
 
533
                i->setText( 5, i18n( "Yes" ) );
 
534
            else
 
535
                i->setText( 5, i18n( "No" ) );
 
536
        } else {
 
537
            i->setText( 5, "---" );
 
538
        }
 
539
    }
 
540
 
 
541
    if ( functionListView->firstChild() )
 
542
        functionListView->setSelected( functionListView->firstChild(), TRUE );
 
543
}
 
544
 
 
545
void EditFunctions::emitItemRenamed( QListViewItem *, int, const QString & text )
 
546
{
 
547
    emit itemRenamed( text ); // Relay signal ( to QLineEdit )
 
548
}