@ -24,15 +24,15 @@
# include "util/scoped_resource.h"
//QT includes
# include < qdir.h>
# include < qlayout.h>
# include < qlabel.h>
# include < qcombobox.h>
# include < qwidgetstack.h>
# include < qfileinfo.h>
# include < qpushbutton.h>
# include < qlineedit.h>
# include < qdict.h>
# include < t qdir.h>
# include < t qlayout.h>
# include < t qlabel.h>
# include < t qcombobox.h>
# include < t qwidgetstack.h>
# include < t qfileinfo.h>
# include < t qpushbutton.h>
# include < t qlineedit.h>
# include < t qdict.h>
//KDE includes
# include <kapplication.h>
@ -55,8 +55,8 @@ using namespace sword;
namespace BookshelfManager {
CSwordSetupDialog : : CSwordSetupDialog ( QWidget * parent , const char * name )
: KDialogBase ( IconList , i18n ( " Bookshelf Manager " ) , Ok , Ok , parent , name , true , true , QString: : null , QString: : null , QString: : null ) ,
CSwordSetupDialog : : CSwordSetupDialog ( T QWidget * parent , const char * name )
: KDialogBase ( IconList , i18n ( " Bookshelf Manager " ) , Ok , Ok , parent , name , true , true , T QString: : null , T QString: : null , T QString: : null ) ,
m_removeModuleListView ( 0 ) ,
m_installModuleListPage ( 0 ) ,
m_installModuleListView ( 0 ) ,
@ -72,75 +72,75 @@ namespace BookshelfManager {
}
void CSwordSetupDialog : : initSwordConfig ( ) {
QFrame* page = m_swordConfigPage = addPage ( i18n ( " Bookshelf path(s) " ) , QString: : null , SmallIcon ( " bt_swordconfig " , 32 ) ) ;
T QFrame* page = m_swordConfigPage = addPage ( i18n ( " Bookshelf path(s) " ) , T QString: : null , SmallIcon ( " bt_swordconfig " , 32 ) ) ;
page - > setMinimumSize ( 500 , 400 ) ;
QGridLayout* layout = new QGridLayout( page , 6 , 4 ) ;
T QGridLayout* layout = new T QGridLayout( page , 6 , 4 ) ;
layout - > setMargin ( 5 ) ;
layout - > setSpacing ( 10 ) ;
layout - > setColStretch ( 0 , 1 ) ;
layout - > setRowStretch ( 5 , 1 ) ;
QLabel* mainLabel = CToolClass : : explanationLabel ( page ,
T QLabel* mainLabel = CToolClass : : explanationLabel ( page ,
i18n ( " Configure bookshelf path(s) " ) ,
i18n ( " You can store your bookshelfs in one or more directories, which you can specify here. " )
) ;
layout - > addMultiCellWidget ( mainLabel , 0 , 0 , 0 , 3 ) ;
QString swordConfPath = BTInstallMgr : : Tool : : LocalConfig : : swordConfigFilename ( ) ;
QLabel* confPathLabel = new QLabel( i18n ( " Your bookshelf configuration file is <b>%1</b> " ) . arg ( swordConfPath ) , page ) ;
T QString swordConfPath = BTInstallMgr : : Tool : : LocalConfig : : swordConfigFilename ( ) ;
T QLabel* confPathLabel = new T QLabel( i18n ( " Your bookshelf configuration file is <b>%1</b> " ) . arg ( swordConfPath ) , page ) ;
layout - > addMultiCellWidget ( confPathLabel , 1 , 1 , 0 , 3 ) ;
m_swordPathListBox = new QListView( page ) ;
m_swordPathListBox = new T QListView( page ) ;
// m_swordPathListBox->setFullWidth(true);
m_swordPathListBox - > addColumn ( i18n ( " Path to bookshelf " ) ) ;
connect ( m_swordPathListBox , SIGNAL( selectionChanged ( ) ) , this , SLOT( slot_swordPathSelected ( ) ) ) ;
connect ( m_swordPathListBox , TQT_ SIGNAL( selectionChanged ( ) ) , this , TQT_ SLOT( slot_swordPathSelected ( ) ) ) ;
layout - > addMultiCellWidget ( m_swordPathListBox , 2 , 5 , 0 , 1 ) ;
m_swordEditPathButton = new QPushButton( i18n ( " Edit Entry " ) , page ) ;
m_swordEditPathButton = new T QPushButton( i18n ( " Edit Entry " ) , page ) ;
m_swordEditPathButton - > setIconSet ( SmallIcon ( " edit " , 16 ) ) ;
connect ( m_swordEditPathButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_swordEditClicked ( ) ) ) ;
connect ( m_swordEditPathButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_swordEditClicked ( ) ) ) ;
layout - > addWidget ( m_swordEditPathButton , 2 , 3 ) ;
m_swordAddPathButton = new QPushButton( i18n ( " Add Entry " ) , page ) ;
m_swordAddPathButton = new T QPushButton( i18n ( " Add Entry " ) , page ) ;
m_swordAddPathButton - > setIconSet ( SmallIcon ( " edit_add " , 16 ) ) ;
connect ( m_swordAddPathButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_swordAddClicked ( ) ) ) ;
connect ( m_swordAddPathButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_swordAddClicked ( ) ) ) ;
layout - > addWidget ( m_swordAddPathButton , 3 , 3 ) ;
m_swordRemovePathButton = new QPushButton( i18n ( " Remove Entry " ) , page ) ;
m_swordRemovePathButton = new T QPushButton( i18n ( " Remove Entry " ) , page ) ;
m_swordRemovePathButton - > setIconSet ( SmallIcon ( " editdelete " , 16 ) ) ;
connect ( m_swordRemovePathButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_swordRemoveClicked ( ) ) ) ;
connect ( m_swordRemovePathButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_swordRemoveClicked ( ) ) ) ;
layout - > addWidget ( m_swordRemovePathButton , 4 , 3 ) ;
setupSwordPathListBox ( ) ;
}
void CSwordSetupDialog : : initInstall ( ) {
m_installPage = addPage ( i18n ( " Install/Update works " ) , QString: : null , SmallIcon ( " bt_bible " , 32 ) ) ;
m_installPage = addPage ( i18n ( " Install/Update works " ) , T QString: : null , SmallIcon ( " bt_bible " , 32 ) ) ;
QVBoxLayout* vboxlayout = new QVBoxLayout( m_installPage ) ;
QHBoxLayout* hboxlayout = new QHBoxLayout( ) ;
T QVBoxLayout* vboxlayout = new T QVBoxLayout( m_installPage ) ;
T QHBoxLayout* hboxlayout = new T QHBoxLayout( ) ;
hboxlayout - > setAutoAdd ( true ) ;
vboxlayout - > addLayout ( hboxlayout ) ;
m_installWidgetStack = new QWidgetStack( m_installPage ) ;
m_installWidgetStack = new T QWidgetStack( m_installPage ) ;
hboxlayout - > addWidget ( m_installWidgetStack ) ;
m_installSourcePage = new QWidget( 0 ) ;
m_installSourcePage = new T QWidget( 0 ) ;
m_installWidgetStack - > addWidget ( m_installSourcePage ) ;
// m_installSourcePage->setMinimumSize(500,400);
QGridLayout* layout = new QGridLayout( m_installSourcePage , 7 , 3 ) ;
T QGridLayout* layout = new T QGridLayout( m_installSourcePage , 7 , 3 ) ;
layout - > setMargin ( 5 ) ;
layout - > setSpacing ( 10 ) ;
layout - > setRowStretch ( 6 , 5 ) ;
layout - > setColStretch ( 0 , 5 ) ;
QLabel* installLabel = CToolClass : : explanationLabel ( m_installSourcePage ,
T QLabel* installLabel = CToolClass : : explanationLabel ( m_installSourcePage ,
i18n ( " Install/update works - Step 1 " ) ,
i18n ( " Please choose a (local or remote) library and a bookshelf path to install the work(s) to. \
After that step click on the connect button . < br / > \
@ -149,100 +149,100 @@ the module remote installation feature!</b>")
) ;
layout - > addMultiCellWidget ( installLabel , 0 , 0 , 0 , 2 ) ;
QLabel* sourceHeadingLabel = new QLabel( QString( " <b>%1</b> " ) . arg ( i18n ( " Select library " ) ) , m_installSourcePage ) ;
T QLabel* sourceHeadingLabel = new T QLabel( T QString( " <b>%1</b> " ) . arg ( i18n ( " Select library " ) ) , m_installSourcePage ) ;
layout - > addMultiCellWidget ( sourceHeadingLabel , 1 , 1 , 0 , 1 ) ;
m_sourceCombo = new QComboBox( m_installSourcePage ) ;
m_sourceCombo = new T QComboBox( m_installSourcePage ) ;
layout - > addWidget ( m_sourceCombo , 2 , 0 ) ;
QPushButton* deleteSourceButton = new QPushButton( i18n ( " Delete library " ) , m_installSourcePage ) ;
T QPushButton* deleteSourceButton = new T QPushButton( i18n ( " Delete library " ) , m_installSourcePage ) ;
deleteSourceButton - > setIconSet ( SmallIcon ( " remove " , 16 ) ) ;
connect ( deleteSourceButton , SIGNAL( clicked ( ) ) , SLOT( slot_installDeleteSource ( ) ) ) ;
connect ( deleteSourceButton , TQT_ SIGNAL( clicked ( ) ) , TQT_ SLOT( slot_installDeleteSource ( ) ) ) ;
layout - > addWidget ( deleteSourceButton , 2 , 1 , Qt : : AlignLeft ) ;
QPushButton* addSourceButton = new QPushButton( i18n ( " Add library " ) , m_installSourcePage ) ;
T QPushButton* addSourceButton = new T QPushButton( i18n ( " Add library " ) , m_installSourcePage ) ;
addSourceButton - > setIconSet ( SmallIcon ( " folder_new " , 16 ) ) ;
connect ( addSourceButton , SIGNAL( clicked ( ) ) , SLOT( slot_installAddSource ( ) ) ) ;
connect ( addSourceButton , TQT_ SIGNAL( clicked ( ) ) , TQT_ SLOT( slot_installAddSource ( ) ) ) ;
layout - > addWidget ( addSourceButton , 2 , 2 , Qt : : AlignLeft ) ;
m_sourceLabel = new QLabel( m_installSourcePage ) ;
m_sourceLabel = new T QLabel( m_installSourcePage ) ;
layout - > addMultiCellWidget ( m_sourceLabel , 3 , 3 , 0 , 1 ) ;
QLabel* targetHeadingLabel = new QLabel( QString( " <b>%1</b> " ) . arg ( i18n ( " Select bookshelf path " ) ) , m_installSourcePage ) ;
T QLabel* targetHeadingLabel = new T QLabel( T QString( " <b>%1</b> " ) . arg ( i18n ( " Select bookshelf path " ) ) , m_installSourcePage ) ;
layout - > addMultiCellWidget ( targetHeadingLabel , 4 , 4 , 0 , 1 ) ;
m_targetCombo = new QComboBox( m_installSourcePage ) ;
m_targetCombo = new T QComboBox( m_installSourcePage ) ;
layout - > addWidget ( m_targetCombo , 5 , 0 ) ;
m_targetLabel = new QLabel( m_installSourcePage ) ;
m_targetLabel = new T QLabel( m_installSourcePage ) ;
layout - > addMultiCellWidget ( m_targetLabel , 6 , 6 , 0 , 0 , Qt : : AlignTop ) ;
//part beloew main layout with the back/next buttons
QHBoxLayout* myHBox = new QHBoxLayout( ) ;
T QHBoxLayout* myHBox = new T QHBoxLayout( ) ;
vboxlayout - > addLayout ( myHBox ) ;
m_installBackButton = new QPushButton( i18n ( " Back " ) , m_installPage ) ;
m_installBackButton = new T QPushButton( i18n ( " Back " ) , m_installPage ) ;
m_installBackButton - > setIconSet ( SmallIcon ( " back " , 16 ) ) ;
myHBox - > addWidget ( m_installBackButton ) ;
myHBox - > addSpacing ( 10 ) ;
myHBox - > addStretch ( 5 ) ;
m_installContinueButton = new QPushButton( i18n ( " Connect to library " ) , m_installPage ) ;
m_installContinueButton = new T QPushButton( i18n ( " Connect to library " ) , m_installPage ) ;
m_installContinueButton - > setIconSet ( SmallIcon ( " forward " , 16 ) ) ;
connect ( m_installContinueButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_connectToSource ( ) ) ) ;
connect ( m_installContinueButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_connectToSource ( ) ) ) ;
myHBox - > addWidget ( m_installContinueButton ) ;
m_installBackButton - > setEnabled ( false ) ;
connect ( m_sourceCombo , SIGNAL( highlighted ( const QString& ) ) , SLOT( slot_sourceSelected ( const QString& ) ) ) ;
connect ( m_targetCombo , SIGNAL( highlighted ( const QString& ) ) , SLOT( slot_targetSelected ( const QString& ) ) ) ;
connect ( m_sourceCombo , TQT_ SIGNAL( highlighted ( const T QString& ) ) , TQT_ SLOT( slot_sourceSelected ( const T QString& ) ) ) ;
connect ( m_targetCombo , TQT_ SIGNAL( highlighted ( const T QString& ) ) , TQT_ SLOT( slot_targetSelected ( const T QString& ) ) ) ;
populateInstallCombos ( ) ;
slot_sourceSelected ( m_sourceCombo - > currentText ( ) ) ;
}
void CSwordSetupDialog : : initRemove ( ) {
QFrame* page = m_removePage = addPage ( i18n ( " Remove works " ) , QString: : null , SmallIcon ( " edittrash " , 32 ) ) ;
T QFrame* page = m_removePage = addPage ( i18n ( " Remove works " ) , T QString: : null , SmallIcon ( " edittrash " , 32 ) ) ;
page - > setMinimumSize ( 500 , 400 ) ;
QGridLayout* layout = new QGridLayout( page , 4 , 4 ) ;
T QGridLayout* layout = new T QGridLayout( page , 4 , 4 ) ;
layout - > setMargin ( 5 ) ;
layout - > setSpacing ( 10 ) ;
layout - > setColStretch ( 1 , 1 ) ;
layout - > setRowStretch ( 2 , 1 ) ;
QLabel* mainLabel = CToolClass : : explanationLabel ( page ,
T QLabel* mainLabel = CToolClass : : explanationLabel ( page ,
i18n ( " Remove installed work(s) " ) ,
i18n ( " This dialog lets you remove installed works from your system. Choose the modules and then click on the remove button. " )
) ;
layout - > addMultiCellWidget ( mainLabel , 0 , 0 , 0 , 3 ) ;
QLabel* headingLabel = new QLabel( QString( " <b>%1</b> " ) . arg ( i18n ( " Select works to be uninstalled " ) ) , page ) ;
T QLabel* headingLabel = new T QLabel( T QString( " <b>%1</b> " ) . arg ( i18n ( " Select works to be uninstalled " ) ) , page ) ;
layout - > addMultiCellWidget ( headingLabel , 1 , 1 , 0 , 3 ) ;
m_removeModuleListView = new CSwordSetupModuleListView ( page , false ) ;
layout - > addMultiCellWidget ( m_removeModuleListView , 2 , 2 , 0 , 3 ) ;
m_removeRemoveButton = new QPushButton( i18n ( " Remove selected work(s) " ) , page ) ;
m_removeRemoveButton = new T QPushButton( i18n ( " Remove selected work(s) " ) , page ) ;
m_removeRemoveButton - > setIconSet ( SmallIcon ( " edittrash " , 16 ) ) ;
layout - > addWidget ( m_removeRemoveButton , 3 , 3 , Qt : : AlignRight ) ;
connect ( m_removeRemoveButton , SIGNAL( clicked ( ) ) ,
this , SLOT( slot_doRemoveModules ( ) ) ) ;
connect ( m_removeRemoveButton , TQT_ SIGNAL( clicked ( ) ) ,
this , TQT_ SLOT( slot_doRemoveModules ( ) ) ) ;
populateRemoveModuleListView ( ) ;
}
void CSwordSetupDialog : : initManageIndices ( )
{
QFrame* page = m_manageIndiciesPage = addPage ( i18n ( " Manage search indicies " ) ,
QString: : null , SmallIcon ( " filefind " , 32 ) ) ;
T QFrame* page = m_manageIndiciesPage = addPage ( i18n ( " Manage search indicies " ) ,
T QString: : null , SmallIcon ( " filefind " , 32 ) ) ;
page - > setMinimumSize ( 500 , 400 ) ;
QVBoxLayout* box = new QVBoxLayout( page , 4 , 4 ) ;
T QVBoxLayout* box = new T QVBoxLayout( page , 4 , 4 ) ;
CManageIndicesWidget * mi = new CManageIndicesWidget ( page ) ;
box - > addWidget ( mi ) ;
}
@ -255,10 +255,10 @@ the module remote installation feature!</b>")
void CSwordSetupDialog : : writeSwordConfig ( ) {
if ( m_swordSetupChanged & & m_swordPathListBox - > childCount ( ) ) {
QStringList targets ;
QListViewItemIterator it ( m_swordPathListBox ) ;
T QStringList targets ;
T QListViewItemIterator it ( m_swordPathListBox ) ;
while ( it . current ( ) ) {
QListViewItem * item = it . current ( ) ;
T QListViewItem * item = it . current ( ) ;
if ( ! item - > text ( 0 ) . isEmpty ( ) ) {
targets < < item - > text ( 0 ) ;
}
@ -293,7 +293,7 @@ the module remote installation feature!</b>")
BTInstallMgr : : Tool : : RemoteConfig : : initConfig ( ) ;
QStringList list ;
T QStringList list ;
{
BTInstallMgr mgr ;
list = BTInstallMgr : : Tool : : RemoteConfig : : sourceList ( & mgr ) ;
@ -312,14 +312,14 @@ the module remote installation feature!</b>")
}
BTInstallMgr mgr ;
for ( QStringList: : iterator it = list . begin ( ) ; it ! = list . end ( ) ; + + it ) {
for ( T QStringList: : iterator it = list . begin ( ) ; it ! = list . end ( ) ; + + it ) {
sword : : InstallSource is = BTInstallMgr : : Tool : : RemoteConfig : : source ( & mgr , * it ) ;
if ( BTInstallMgr : : Tool : : RemoteConfig : : isRemoteSource ( & is ) ) {
m_sourceCombo - > insertItem ( i18n ( " [Remote] " ) + " " + * it ) ; //remote source
}
else { // local source
QFileInfo fi ( is . directory . c_str ( ) ) ;
T QFileInfo fi ( is . directory . c_str ( ) ) ;
if ( fi . isDir ( ) & & fi . isReadable ( ) ) {
m_sourceCombo - > insertItem ( i18n ( " [Local] " ) + " " + * it ) ;
}
@ -330,7 +330,7 @@ the module remote installation feature!</b>")
//list = (m_targetCombo->count()) ? m_swordPathListBox : BTInstallMgr::Tool::LocalConfig::targetList();
if ( m_targetCombo - > count ( ) ) { //we already read in the list once, we have to use the Sword paths list items now because this list is newer
list . clear ( ) ;
QListViewItemIterator it2 ( m_swordPathListBox ) ;
T QListViewItemIterator it2 ( m_swordPathListBox ) ;
while ( it2 . current ( ) ) {
list < < it2 . current ( ) - > text ( 0 ) ;
@ -342,8 +342,8 @@ the module remote installation feature!</b>")
}
m_targetCombo - > clear ( ) ;
for ( QStringList: : iterator it = list . begin ( ) ; it ! = list . end ( ) ; + + it ) {
QFileInfo fi ( * it ) ;
for ( T QStringList: : iterator it = list . begin ( ) ; it ! = list . end ( ) ; + + it ) {
T QFileInfo fi ( * it ) ;
if ( fi . isDir ( ) & & fi . isWritable ( ) ) {
m_targetCombo - > insertItem ( * it ) ;
}
@ -359,11 +359,11 @@ the module remote installation feature!</b>")
}
void CSwordSetupDialog : : slot_sourceSelected ( const QString & sourceName ) {
void CSwordSetupDialog : : slot_sourceSelected ( const T QString & sourceName ) {
//remove status parta
QString source = sourceName ;
T QString source = sourceName ;
QString rep = i18n ( " [Local] " ) + " " ;
T QString rep = i18n ( " [Local] " ) + " " ;
int i = source . find ( rep ) ;
if ( i > = 0 ) {
source . remove ( i , rep . length ( ) ) ;
@ -375,14 +375,14 @@ the module remote installation feature!</b>")
}
BTInstallMgr mgr ;
QString url ;
T QString url ;
sword : : InstallSource is = BTInstallMgr : : Tool : : RemoteConfig : : source ( & mgr , source ) ;
if ( BTInstallMgr : : Tool : : RemoteConfig : : isRemoteSource ( & is ) ) {
url = QString( " ftp://%1%2 " ) . arg ( is . source . c_str ( ) ) . arg ( is . directory . c_str ( ) ) ;
url = T QString( " ftp://%1%2 " ) . arg ( is . source . c_str ( ) ) . arg ( is . directory . c_str ( ) ) ;
}
else {
url = QString( " %1 " ) . arg ( is . directory . c_str ( ) ) ;
url = T QString( " %1 " ) . arg ( is . directory . c_str ( ) ) ;
}
m_sourceLabel - > setText ( url ) ;
@ -390,7 +390,7 @@ the module remote installation feature!</b>")
}
void CSwordSetupDialog : : slot_targetSelected ( const QString & targetName ) {
void CSwordSetupDialog : : slot_targetSelected ( const T QString & targetName ) {
m_targetLabel - > setText ( m_targetMap [ targetName ] ) ;
target = m_targetMap [ targetName ] ;
}
@ -398,23 +398,23 @@ the module remote installation feature!</b>")
void CSwordSetupDialog : : slot_doRemoveModules ( ) {
QStringList moduleList = m_removeModuleListView - > selectedModules ( ) ;
T QStringList moduleList = m_removeModuleListView - > selectedModules ( ) ;
if ( moduleList . empty ( ) ) {
return ; //no message, just do nothing
}
const QString message = i18n ( " You selected the following work(s): %1. \n \n "
const T QString message = i18n ( " You selected the following work(s): %1. \n \n "
" Do you really want to remove them from your system? " ) . arg ( moduleList . join ( " , " ) ) ;
if ( ( KMessageBox : : warningYesNo ( 0 , message , i18n ( " Warning " ) ) = = KMessageBox : : Yes ) ) { //Yes was pressed.
sword : : InstallMgr installMgr ;
QDict< sword : : SWMgr > mgrDict ; //maps config paths to SWMgr objects
T QDict< sword : : SWMgr > mgrDict ; //maps config paths to SWMgr objects
for ( QStringList: : Iterator it = moduleList . begin ( ) ; it ! = moduleList . end ( ) ; + + it ) {
for ( T QStringList: : Iterator it = moduleList . begin ( ) ; it ! = moduleList . end ( ) ; + + it ) {
if ( CSwordModuleInfo * m = backend ( ) - > findModuleByName ( * it ) ) { //module found?
QString prefixPath = m - > config ( CSwordModuleInfo : : AbsoluteDataPath ) + " / " ;
QString dataPath = m - > config ( CSwordModuleInfo : : DataPath ) ;
T QString prefixPath = m - > config ( CSwordModuleInfo : : AbsoluteDataPath ) + " / " ;
T QString dataPath = m - > config ( CSwordModuleInfo : : DataPath ) ;
if ( dataPath . left ( 2 ) = = " ./ " ) {
dataPath = dataPath . mid ( 2 ) ;
@ -424,7 +424,7 @@ the module remote installation feature!</b>")
prefixPath = prefixPath . remove ( prefixPath . find ( dataPath ) , dataPath . length ( ) ) ;
}
else { //fall back to default Sword config path
prefixPath = QString: : fromLatin1 ( backend ( ) - > prefixPath ) ;
prefixPath = T QString: : fromLatin1 ( backend ( ) - > prefixPath ) ;
}
sword : : SWMgr * mgr = mgrDict [ prefixPath ] ;
@ -471,7 +471,7 @@ the module remote installation feature!</b>")
m_removeModuleListView - > finish ( ) ;
}
const bool CSwordSetupDialog : : refreshRemoteModuleCache ( const QString& sourceName ) {
const bool CSwordSetupDialog : : refreshRemoteModuleCache ( const T QString& sourceName ) {
if ( m_refreshedRemoteSources ) { //the module info is up-to-date
return true ;
}
@ -481,7 +481,7 @@ the module remote installation feature!</b>")
sword : : InstallSource is = BTInstallMgr : : Tool : : RemoteConfig : : source ( & iMgr , sourceName ) ;
bool success = false ;
m_progressDialog = new KProgressDialog ( this , 0 , i18n ( " Download " ) , QString: : null , true ) ;
m_progressDialog = new KProgressDialog ( this , 0 , i18n ( " Download " ) , T QString: : null , true ) ;
m_progressDialog - > progressBar ( ) - > setTotalSteps ( 100 ) ;
m_progressDialog - > setLabel ( i18n ( " Downloading library information... " ) ) ;
m_progressDialog - > setMinimumDuration ( 0 ) ; //show immediately
@ -490,12 +490,12 @@ the module remote installation feature!</b>")
KApplication : : kApplication ( ) - > processEvents ( ) ;
connect (
m_progressDialog , SIGNAL( cancelClicked ( ) ) ,
SLOT( slot_moduleRefreshProgressCancelClicked ( ) )
m_progressDialog , TQT_ SIGNAL( cancelClicked ( ) ) ,
TQT_ SLOT( slot_moduleRefreshProgressCancelClicked ( ) )
) ;
connect (
& iMgr , SIGNAL( completed ( const int , const int ) ) ,
SLOT( slot_moduleRefreshCompleted ( const int , const int ) )
& iMgr , TQT_ SIGNAL( completed ( const int , const int ) ) ,
TQT_ SLOT( slot_moduleRefreshCompleted ( const int , const int ) )
) ;
@ -521,7 +521,7 @@ the module remote installation feature!</b>")
return success ;
}
bool CSwordSetupDialog : : populateInstallModuleListView ( const QString& sourceName ) {
bool CSwordSetupDialog : : populateInstallModuleListView ( const T QString& sourceName ) {
KApplication : : kApplication ( ) - > processEvents ( ) ;
Q_ASSERT ( m_installModuleListView ) ;
if ( ! m_installModuleListView ) { // this may be an update after removing modules
@ -596,7 +596,7 @@ the module remote installation feature!</b>")
( * it ) ,
installedModule
? installedModule - > config ( CSwordModuleInfo : : ModuleVersion )
: QString: : null
: T QString: : null
) ;
}
m_installModuleListView - > finish ( ) ;
@ -605,13 +605,13 @@ the module remote installation feature!</b>")
void CSwordSetupDialog : : slot_connectToSource ( ) {
if ( ! m_installModuleListPage ) { //the widgets are not yet created
m_installModuleListPage = new QWidget( 0 ) ;
m_installModuleListPage = new T QWidget( 0 ) ;
QGridLayout* layout = new QGridLayout( m_installModuleListPage , 7 , 2 ) ;
T QGridLayout* layout = new T QGridLayout( m_installModuleListPage , 7 , 2 ) ;
layout - > setMargin ( 5 ) ;
layout - > setSpacing ( 10 ) ;
QLabel* installLabel = CToolClass : : explanationLabel ( m_installModuleListPage ,
T QLabel* installLabel = CToolClass : : explanationLabel ( m_installModuleListPage ,
i18n ( " Install/update works - Step 2 " ) ,
i18n ( " Please choose the works which should be installed and/or updated and click the install button. " )
) ;
@ -630,21 +630,21 @@ the module remote installation feature!</b>")
layout - > setColStretch ( 0 , 5 ) ;
layout - > setRowStretch ( 1 , 5 ) ;
connect ( m_installModuleListView , SIGNAL( selectedModulesChanged ( ) ) , SLOT( slot_installModulesChanged ( ) ) ) ;
connect ( m_installModuleListView , TQT_ SIGNAL( selectedModulesChanged ( ) ) , TQT_ SLOT( slot_installModulesChanged ( ) ) ) ;
}
if ( populateInstallModuleListView ( currentInstallSource ( ) ) ) {
//code valid for already existing and newly created widgets
disconnect ( m_installContinueButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_connectToSource ( ) ) ) ;
connect ( m_installContinueButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_installModules ( ) ) ) ;
disconnect ( m_installContinueButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_connectToSource ( ) ) ) ;
connect ( m_installContinueButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_installModules ( ) ) ) ;
m_installContinueButton - > setText ( i18n ( " Install works " ) ) ;
m_installContinueButton - > setEnabled ( false ) ;
m_installWidgetStack - > raiseWidget ( m_installModuleListPage ) ;
connect ( m_installBackButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_showInstallSourcePage ( ) ) ) ;
connect ( m_installBackButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_showInstallSourcePage ( ) ) ) ;
m_installBackButton - > setEnabled ( true ) ;
}
}
@ -653,7 +653,7 @@ the module remote installation feature!</b>")
sword : : InstallSource newSource = CSwordSetupInstallSourcesDialog : : getSource ( ) ;
if ( ! ( ( QString) newSource . type . c_str ( ) ) . isEmpty ( ) ) { // we have a valid source to add
if ( ! ( ( T QString) newSource . type . c_str ( ) ) . isEmpty ( ) ) { // we have a valid source to add
BTInstallMgr : : Tool : : RemoteConfig : : addSource ( & newSource ) ;
}
@ -684,13 +684,13 @@ the module remote installation feature!</b>")
// m_installBackButton->setEnabled(false);
//first get all chosen modules
QStringList moduleList = m_installModuleListView - > selectedModules ( ) ;
T QStringList moduleList = m_installModuleListView - > selectedModules ( ) ;
Q_ASSERT ( moduleList . count ( ) ! = 0 ) ;
if ( moduleList . count ( ) = = 0 ) { // no modules selected
return ;
}
const QString message = i18n ( " You selected the following works: %1. \n \n \
const T QString message = i18n ( " You selected the following works: %1. \n \n \
Do you really want to install them on your system ? " ).arg(moduleList.join( " , " ));
if ( ( KMessageBox : : warningYesNo ( 0 , message , i18n ( " Warning " ) ) = = KMessageBox : : Yes ) ) { //Yes was pressed.
@ -699,10 +699,10 @@ the module remote installation feature!</b>")
sword : : InstallSource is = BTInstallMgr : : Tool : : RemoteConfig : : source ( & iMgr , currentInstallSource ( ) ) ;
qWarning ( " installing from %s/%s " , is . source . c_str ( ) , is . directory . c_str ( ) ) ;
QString target = m_targetCombo - > currentText ( ) ;
T QString target = m_targetCombo - > currentText ( ) ;
//make sure target/mods.d and target/modules exist
QDir dir ( target . latin1 ( ) ) ;
T QDir dir ( target . latin1 ( ) ) ;
if ( ! dir . exists ( ) ) {
dir . mkdir ( target , true ) ;
}
@ -717,7 +717,7 @@ the module remote installation feature!</b>")
//module are removed in this section of code
m_installedModuleCount = 0 ;
m_progressDialog = new KProgressDialog ( this , 0 , i18n ( " Download of work(s) " ) , QString: : null , true ) ;
m_progressDialog = new KProgressDialog ( this , 0 , i18n ( " Download of work(s) " ) , T QString: : null , true ) ;
m_progressDialog - > progressBar ( ) - > setTotalSteps ( 100 * moduleList . count ( ) ) ;
m_progressDialog - > setMinimumDuration ( 0 ) ; //show immediately
m_progressDialog - > setAutoClose ( false ) ;
@ -725,15 +725,15 @@ the module remote installation feature!</b>")
KApplication : : kApplication ( ) - > processEvents ( ) ;
connect (
m_progressDialog , SIGNAL( cancelClicked ( ) ) ,
SLOT( slot_installProgressCancelClicked ( ) )
m_progressDialog , TQT_ SIGNAL( cancelClicked ( ) ) ,
TQT_ SLOT( slot_installProgressCancelClicked ( ) )
) ;
connect (
& iMgr , SIGNAL( completed ( const int , const int ) ) ,
SLOT( installCompleted ( const int , const int ) )
& iMgr , TQT_ SIGNAL( completed ( const int , const int ) ) ,
TQT_ SLOT( installCompleted ( const int , const int ) )
) ;
for ( QStringList: : Iterator it = moduleList . begin ( ) ; ( it ! = moduleList . end ( ) ) & & ! m_progressDialog - > wasCancelled ( ) ; + + it , + + m_installedModuleCount ) {
for ( T QStringList: : Iterator it = moduleList . begin ( ) ; ( it ! = moduleList . end ( ) ) & & ! m_progressDialog - > wasCancelled ( ) ; + + it , + + m_installedModuleCount ) {
qWarning ( " installing %s " , ( * it ) . latin1 ( ) ) ;
m_installingModule = * it ;
@ -742,8 +742,8 @@ the module remote installation feature!</b>")
CSwordModuleInfo * m = backend ( ) - > findModuleByName ( * it ) ;
Q_ASSERT ( ! m ) ;
if ( m ) { //module found?
QString prefixPath = m - > config ( CSwordModuleInfo : : AbsoluteDataPath ) + " / " ;
QString dataPath = m - > config ( CSwordModuleInfo : : DataPath ) ;
T QString prefixPath = m - > config ( CSwordModuleInfo : : AbsoluteDataPath ) + " / " ;
T QString dataPath = m - > config ( CSwordModuleInfo : : DataPath ) ;
if ( dataPath . left ( 2 ) = = " ./ " ) {
dataPath = dataPath . mid ( 2 ) ;
}
@ -753,7 +753,7 @@ the module remote installation feature!</b>")
//prefixPath = prefixPath.replace(dataPath, ""); //old code working with Qt 3.2
}
else {
prefixPath = QString: : fromLatin1 ( backend ( ) - > prefixPath ) ;
prefixPath = T QString: : fromLatin1 ( backend ( ) - > prefixPath ) ;
}
sword : : SWMgr mgr ( prefixPath . latin1 ( ) ) ;
@ -796,8 +796,8 @@ the module remote installation feature!</b>")
}
void CSwordSetupDialog : : slot_showInstallSourcePage ( ) {
connect ( m_installContinueButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_connectToSource ( ) ) ) ;
disconnect ( m_installContinueButton , SIGNAL( clicked ( ) ) , this , SLOT( slot_installModules ( ) ) ) ;
connect ( m_installContinueButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_connectToSource ( ) ) ) ;
disconnect ( m_installContinueButton , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( slot_installModules ( ) ) ) ;
m_installBackButton - > setEnabled ( false ) ;
m_installContinueButton - > setText ( i18n ( " Connect to library " ) ) ;
@ -807,10 +807,10 @@ the module remote installation feature!</b>")
}
void CSwordSetupDialog : : slot_swordEditClicked ( ) {
if ( QListViewItem* i = m_swordPathListBox - > currentItem ( ) ) {
if ( T QListViewItem* i = m_swordPathListBox - > currentItem ( ) ) {
KURL url = KDirSelectDialog : : selectDirectory ( i - > text ( 0 ) , true ) ;
if ( url . isValid ( ) ) {
const QFileInfo fi ( url . path ( ) ) ;
const T QFileInfo fi ( url . path ( ) ) ;
if ( ! fi . exists ( ) | | ! fi . isWritable ( ) ) {
const int result = KMessageBox : : warningYesNo ( this , i18n ( " This directory is not writable, so works \
can not be installed here using BibleTime . \
@ -829,9 +829,9 @@ the module remote installation feature!</b>")
}
void CSwordSetupDialog : : slot_swordAddClicked ( ) {
KURL url = KDirSelectDialog : : selectDirectory ( QString: : null , true ) ;
KURL url = KDirSelectDialog : : selectDirectory ( T QString: : null , true ) ;
if ( url . isValid ( ) ) {
const QFileInfo fi ( url . path ( ) ) ;
const T QFileInfo fi ( url . path ( ) ) ;
if ( ! fi . exists ( ) | | ! fi . isWritable ( ) ) {
const int result = KMessageBox : : warningYesNo ( this , i18n ( " This directory is not writable, \
so works can not be installed here using BibleTime . \
@ -840,7 +840,7 @@ the module remote installation feature!</b>")
return ;
}
}
( void ) new QListViewItem( m_swordPathListBox , url . path ( ) ) ;
( void ) new T QListViewItem( m_swordPathListBox , url . path ( ) ) ;
m_swordSetupChanged = true ;
writeSwordConfig ( ) ; //to make sure other parts work with the new setting
populateInstallCombos ( ) ; //update target list bof on install page
@ -849,7 +849,7 @@ the module remote installation feature!</b>")
}
void CSwordSetupDialog : : slot_swordRemoveClicked ( ) {
QListViewItem* i = m_swordPathListBox - > currentItem ( ) ;
T QListViewItem* i = m_swordPathListBox - > currentItem ( ) ;
if ( i ) {
delete i ;
@ -861,14 +861,14 @@ the module remote installation feature!</b>")
}
void CSwordSetupDialog : : setupSwordPathListBox ( ) {
QStringList targets = BTInstallMgr : : Tool : : LocalConfig : : targetList ( ) ;
T QStringList targets = BTInstallMgr : : Tool : : LocalConfig : : targetList ( ) ;
m_swordPathListBox - > clear ( ) ;
for ( QStringList: : iterator it = targets . begin ( ) ; it ! = targets . end ( ) ; + + it ) {
for ( T QStringList: : iterator it = targets . begin ( ) ; it ! = targets . end ( ) ; + + it ) {
if ( ( * it ) . isEmpty ( ) ) {
continue ;
}
new QListViewItem( m_swordPathListBox , * it ) ;
new T QListViewItem( m_swordPathListBox , * it ) ;
}
m_swordPathListBox - > setCurrentItem ( m_swordPathListBox - > firstChild ( ) ) ;
}
@ -877,9 +877,9 @@ the module remote installation feature!</b>")
m_swordEditPathButton - > setEnabled ( m_swordPathListBox - > currentItem ( ) ) ;
}
const QString CSwordSetupDialog : : currentInstallSource ( ) {
QString source = m_sourceCombo - > currentText ( ) ;
QString rep = i18n ( " [Local] " ) + " " ;
const T QString CSwordSetupDialog : : currentInstallSource ( ) {
T QString source = m_sourceCombo - > currentText ( ) ;
T QString rep = i18n ( " [Local] " ) + " " ;
int i = source . find ( rep ) ;
if ( i > = 0 ) {
source . remove ( i , rep . length ( ) ) ;