]> Git trees. - libqmvoc.git/commitdiff
* better check in case of loading error
authorPino Toscano <pino@kde.org>
Mon, 4 Jul 2005 11:31:16 +0000 (11:31 +0000)
committerPino Toscano <pino@kde.org>
Mon, 4 Jul 2005 11:31:16 +0000 (11:31 +0000)
* re-enabling the GUI creation
* minor APIdox improvements

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=431450

kdeeduui/Makefile.am
kdeeduui/kdeeduglossary.cpp
kdeeduui/kdeeduglossary.h

index dbec4004d0efe817f942ad8d652bcfb54d926834..52e27835d4b485c7e66741139610dcb2ff4597b0 100644 (file)
@@ -6,6 +6,9 @@ lib_LTLIBRARIES = libkdeeduui.la
 libkdeeduui_la_SOURCES = \
             kedusimpleentrydlg.cpp  kedusimpleentrydlgForm.ui kdeeduglossary.cpp
 
+libkdeeduuiincludedir = $(includedir)/libkdeedu
+libkdeeduuiinclude_HEADERS = kdeeduglossary.h
+
 libkdeeduui_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 3:5:0
 libkdeeduui_la_LIBADD = $(LIB_KDECORE) $(LIB_KIO) $(LIB_KDEUI) $(LIB_KHTML)
 
index f6b020897b36a1782689ac63f0b72c194c8a9d6b..8e20212b3e6c43a1339e4a6e3a930973c1e0057c 100644 (file)
@@ -34,8 +34,11 @@ bool Glossary::loadLayout( QDomDocument &Document, const KURL& url )
         QFile layoutFile( url.path() );
 
         if (!layoutFile.exists())
-                       kdDebug() << "no such file: " << layoutFile.name() << endl;
-               
+       {
+               kdDebug() << "no such file: " << layoutFile.name() << endl;
+               return false;
+       }
+
         if (!layoutFile.open(IO_ReadOnly))
                 return false;
 
@@ -135,38 +138,38 @@ GlossaryDialog::GlossaryDialog( QWidget *parent, const char *name)
 //X    m_htmlbasestring.append( baseHtml );
 //X    m_htmlbasestring.append("\">");
 //X    
-//X    QVBoxLayout *vbox = new QVBoxLayout( plainPage(), 0, KDialog::spacingHint() );
-//X    vbox->activate();
-//X 
-//X    QHBoxLayout *hbox = new QHBoxLayout( 0L, 0, KDialog::spacingHint() );
-//X    hbox->activate();
-//X 
-//X    QToolButton *clear = new QToolButton( plainPage() );
-//X    clear->setIconSet( SmallIconSet( "locationbar_erase" ) );
-//X    hbox->addWidget( clear );
-//X 
-//X    QLabel *lbl = new QLabel( plainPage() );
-//X    lbl->setText( i18n( "Search:" ) );
-//X    hbox->addWidget( lbl );
-//X 
-//X    m_search = new KListViewSearchLine( plainPage(), 0, "search-line" );
-//X    hbox->addWidget( m_search );
-//X    vbox->addLayout( hbox );
-//X    setFocusProxy(m_search);
-//X 
-//X    QSplitter *vs = new QSplitter( plainPage() );
-//X    vbox->addWidget( vs );
-//X    
-//X    m_glosstree = new KListView( vs, "treeview" );
-//X    m_glosstree->addColumn( "entries" );
-//X    m_glosstree->header()->hide();
-//X    m_glosstree->setFullWidth( true );
-//X    m_glosstree->setRootIsDecorated( true );
-//X 
-//X    m_search->setListView( m_glosstree );
-//X 
-//X    m_htmlpart = new KHTMLPart( vs, "html-part" );
-//X 
+       QVBoxLayout *vbox = new QVBoxLayout( plainPage(), 0, KDialog::spacingHint() );
+       vbox->activate();
+
+       QHBoxLayout *hbox = new QHBoxLayout( 0L, 0, KDialog::spacingHint() );
+       hbox->activate();
+
+       QToolButton *clear = new QToolButton( plainPage() );
+       clear->setIconSet( SmallIconSet( "locationbar_erase" ) );
+       hbox->addWidget( clear );
+
+       QLabel *lbl = new QLabel( plainPage() );
+       lbl->setText( i18n( "Search:" ) );
+       hbox->addWidget( lbl );
+
+       m_search = new KListViewSearchLine( plainPage(), 0, "search-line" );
+       hbox->addWidget( m_search );
+       vbox->addLayout( hbox );
+       setFocusProxy(m_search);
+       QSplitter *vs = new QSplitter( plainPage() );
+       vbox->addWidget( vs );
+       
+       m_glosstree = new KListView( vs, "treeview" );
+       m_glosstree->addColumn( "entries" );
+       m_glosstree->header()->hide();
+       m_glosstree->setFullWidth( true );
+       m_glosstree->setRootIsDecorated( true );
+       m_search->setListView( m_glosstree );
+       m_htmlpart = new KHTMLPart( vs, "html-part" );
 //X    m_actionCollection = new KActionCollection(this);
 //X         KStdAction::quit(this, SLOT(slotClose()), m_actionCollection);
 //X 
@@ -184,11 +187,11 @@ GlossaryDialog::GlossaryDialog( QWidget *parent, const char *name)
 //X 
 //X    populateTree();
 //X 
-//X    connect( m_htmlpart->browserExtension(), SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ), this, SLOT( displayItem( const KURL &, const KParts::URLArgs & ) ) );
-//X    connect( m_glosstree, SIGNAL(clicked( QListViewItem * )), this, SLOT(slotClicked( QListViewItem * )));
-//X    connect( clear, SIGNAL(clicked()), m_search, SLOT(clear()));
-//X 
-//X    resize( 550, 400 );
+       connect( m_htmlpart->browserExtension(), SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ), this, SLOT( displayItem( const KURL &, const KParts::URLArgs & ) ) );
+       connect( m_glosstree, SIGNAL(clicked( QListViewItem * )), this, SLOT(slotClicked( QListViewItem * )));
+       connect( clear, SIGNAL(clicked()), m_search, SLOT(clear()));
+       resize( 550, 400 );
 }
 
 GlossaryDialog::~GlossaryDialog()
index e8c11eef83cef23f995d89bcb9d43ce3ce21d51b..64b57093c9a6275beca99ef46f0d910bf413cf48 100644 (file)
@@ -76,6 +76,14 @@ class Glossary
                        m_itemlist = list;
                }
 
+               /**
+                * Read a glossary from an XML file.
+                *
+                * @param url The path of the file to load
+                *
+                * @return a pointer to the loaded glossary. Even in case of
+                *         error, this won't return 0 but an empty Glossary.
+                */
                static Glossary* readFromXML( const KURL& url );
        
        private:
@@ -87,14 +95,16 @@ class Glossary
                virtual QValueList<GlossaryItem*> readItems( QDomDocument &itemDocument );
                
                /**
-                * Read a glossary from an XML file.
+                * Load the layout from an XML file.
                 *
+                * @param doc The QDomDocument which will contain the read XML
+                *            contents.
                 * @param url The path of the file to load
                 *
-                * @return a pointer to the loaded glossary. Even in case of
-                *         error, this won't return 0 but an empty Glossary.
+                * @return a bool indicating whether the loading of the XML was
+                *         successfull or not
                 */
-               bool loadLayout( QDomDocument&, const KURL& url );
+               bool loadLayout( QDomDocument& doc, const KURL& url );
        
                QValueList<GlossaryItem*> m_itemlist;