Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

selectitem.ui.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   selectitem.ui.h                                                       *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   Read the file COPYING for details.                                    *
00011  *                                                                         *
00012  *   copyright: (C) 2003 by Jan Mueller                                    *
00013  *   email: janmueller7@hotmail.com                                        *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 /****************************************************************************
00018 ** ui.h extension file, included from the uic-generated form implementation.
00019 **
00020 ** If you wish to add, delete or rename functions or slots use
00021 ** Qt Designer which will update this file, preserving your code. Create an
00022 ** init() function in place of a constructor, and a destroy() function in
00023 ** place of a destructor.
00024 *****************************************************************************/
00025 
00026 void SelectItem::incrementalSearch( const QString& s )
00027 {
00028   items->setCurrentItem(items->findItem(s, 0, Qt::BeginsWith));
00029   items->ensureItemVisible(items->findItem(s, 0, Qt::BeginsWith));
00030 }
00031 
00032 
00033 QString SelectItem::url()
00034 {   
00035     if(!items->selectedItem()) return 0L;
00036     LinkListBoxItem *i=dynamic_cast<LinkListBoxItem*>(items->selectedItem());
00037     Q_ASSERT(i);
00038     return i->url();
00039 }
00040 
00041 QString SelectItem::text()
00042 {   
00043     if(!items->selectedItem()) return 0L;
00044     LinkListBoxItem *i=dynamic_cast<LinkListBoxItem*>(items->selectedItem());
00045     Q_ASSERT(i);
00046     return i->text(0);
00047 }
00048 
00049 
00050 void SelectItem::setData(QString cmd, QString query)
00051 {
00052   QSqlQuery q(query);
00053   QSqlRecord r=QSqlDatabase::database()->record(q);
00054   Q_ASSERT(r.position("no")!=-1);
00055   items->clear();
00056   items->addColumn("");
00057   items->setColumnText(0, "Names");
00058   
00059   while(q.next()) {
00060     QString str;
00061     for(unsigned int i=0; i<r.count(); i++) 
00062       if(r.fieldName(i)!="no")   
00063         str+=q.value(i).toString()+" ";
00064     debug("SelectItem::setData():"+LitUrl("lit://"+cmd+"?no="+q.value(r.position("no")).toString()));
00065     new LinkListBoxItem(items, str, LitUrl("lit://"+cmd+"?no="+q.value(r.position("no")).toString()));
00066   }
00067 }
00068 
00069 

Generated on Sat Mar 27 19:20:44 2004 for Literature by doxygen 1.3.6-20040222