diff options
Diffstat (limited to 'kexi/main/startup/KexiStartupFileDialog_win.cpp')
-rw-r--r-- | kexi/main/startup/KexiStartupFileDialog_win.cpp | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/kexi/main/startup/KexiStartupFileDialog_win.cpp b/kexi/main/startup/KexiStartupFileDialog_win.cpp index aa06fb9a..a51cd0c4 100644 --- a/kexi/main/startup/KexiStartupFileDialog_win.cpp +++ b/kexi/main/startup/KexiStartupFileDialog_win.cpp @@ -18,7 +18,7 @@ */ /*! - Temporary moved from QKW KFileDialog implementation. + Temporary moved from TQKW KFileDialog implementation. TODO: move to KDElibs/win32 KFileDialog wrapper */ @@ -29,8 +29,8 @@ #include <kdebug.h> #include <krecentdirs.h> -#include <qobjectlist.h> -#include <qlineedit.h> +#include <tqobjectlist.h> +#include <tqlineedit.h> #include <win/win32_utils.h> @@ -41,31 +41,31 @@ class KexiStartupFileDialogBasePrivate KexiStartupFileDialogBasePrivate() {} KFile::Mode mode; - QString kde_filters; - QStringList mimetypes; + TQString kde_filters; + TQStringList mimetypes; }; KexiStartupFileDialogBase::KexiStartupFileDialogBase( - const QString & dirName, const QString & filter, - QWidget * parent, const char * name, bool modal ) - : QFileDialog( realStartDir(dirName), filter, parent, name, modal ) + const TQString & dirName, const TQString & filter, + TQWidget * tqparent, const char * name, bool modal ) + : TQFileDialog( realStartDir(dirName), filter, tqparent, name, modal ) , d(new KexiStartupFileDialogBasePrivate()) { -// QString _dirName = dirName; - QString _dirName = dirPath(); +// TQString _dirName = dirName; + TQString _dirName = dirPath(); //make default 'My Documents' folder //TODO: store changes in the app's config file? if (_dirName.isEmpty()) _dirName = KGlobalSettings::documentPath(); - init(_dirName, filter, parent); + init(_dirName, filter, tqparent); - //find "OK" button - QObjectList *l = queryList( "QPushButton", "OK", false ); - m_okBtn = dynamic_cast<QPushButton*>(l->first()); + //tqfind "OK" button + TQObjectList *l = queryList( TQPUSHBUTTON_OBJECT_NAME_STRING, "OK", false ); + m_okBtn = dynamic_cast<TQPushButton*>(l->first()); delete l; - l = queryList( "QLineEdit", "name/filter editor", false ); - m_lineEdit = dynamic_cast<QLineEdit*>(l->first()); + l = queryList( TQLINEEDIT_OBJECT_NAME_STRING, "name/filter editor", false ); + m_lineEdit = dynamic_cast<TQLineEdit*>(l->first()); delete l; adjustSize(); @@ -75,7 +75,7 @@ KexiStartupFileDialogBase::~KexiStartupFileDialogBase() { } -void KexiStartupFileDialogBase::init(const QString& startDir, const QString& filter, QWidget* widget) +void KexiStartupFileDialogBase::init(const TQString& startDir, const TQString& filter, TQWidget* widget) { //TODO initStatic(); //TODO d = new KFileDialogPrivate(); @@ -85,16 +85,16 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil //TODO d->operationMode = Opening; setMode(KFile::File | KFile::ExistingOnly); //(js) default: open action setIcon( KGlobal::iconLoader()->loadIcon("fileopen", KIcon::Desktop) ); - setDir(QDir(startDir)); + setDir(TQDir(startDir)); //TODO d->hasDefaultFilter = false; //TODO d->hasView = false; -//(js) d->mainWidget = new QWidget( this, "KFileDialog::mainWidget"); +//(js) d->mainWidget = new TQWidget( this, "KFileDialog::mainWidget"); //(js) setMainWidget( d->mainWidget ); //(js) d->okButton = new KPushButton( KStdGuiItem::ok(), d->mainWidget ); //(js) d->okButton->setDefault( true ); //(js) d->cancelButton = new KPushButton(KStdGuiItem::cancel(), d->mainWidget); -//(js) connect( d->okButton, SIGNAL( clicked() ), SLOT( slotOk() )); -//(js) connect( d->cancelButton, SIGNAL( clicked() ), SLOT( slotCancel() )); +//(js) connect( d->okButton, TQT_SIGNAL( clicked() ), TQT_SLOT( slotOk() )); +//(js) connect( d->cancelButton, TQT_SIGNAL( clicked() ), TQT_SLOT( slotCancel() )); //(js) d->customWidget = widget; //(js) d->autoSelectExtCheckBox = 0; // delayed loading //TODO d->autoSelectExtChecked = false; @@ -105,42 +105,42 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil //TODO true ); //TODO d->completionLock = false; -//TODO QtMsgHandler oldHandler = qInstallMsgHandler( silenceQToolBar ); +//TODO TQtMsgHandler oldHandler = tqInstallMsgHandler( silenceTQToolBar ); //TODO toolbar = 0; //(js) //(js) toolbar = new KToolBar( d->mainWidget, "KFileDialog::toolbar", true); //(js) toolbar->setFlat(true); -//TODO qInstallMsgHandler( oldHandler ); +//TODO tqInstallMsgHandler( oldHandler ); //(js) d->pathCombo = new KURLComboBox( KURLComboBox::Directories, true, //(js) toolbar, "path combo" ); -//(js) QToolTip::add( d->pathCombo, i18n("Often used directories") ); -//(js) QWhatsThis::add( d->pathCombo, "<qt>" + i18n("Commonly used locations are listed here. " +//(js) TQToolTip::add( d->pathCombo, i18n("Often used directories") ); +//(js) TQWhatsThis::add( d->pathCombo, "<qt>" + i18n("Commonly used locations are listed here. " //(js) "This includes standard locations, such as your home directory, as well as " //(js) "locations that have been visited recently.") + autocompletionWhatsThisText); /* KURL u; - u.setPath( QDir::rootDirPath() ); - QString text = i18n("Root Directory: %1").arg( u.path() ); + u.setPath( TQDir::rootDirPath() ); + TQString text = i18n("Root Directory: %1").tqarg( u.path() ); d->pathCombo->addDefaultURL( u, KMimeType::pixmapForURL( u, 0, KIcon::Small ), text ); - u.setPath( QDir::homeDirPath() ); - text = i18n("Home Directory: %1").arg( u.path( +1 ) ); + u.setPath( TQDir::homeDirPath() ); + text = i18n("Home Directory: %1").tqarg( u.path( +1 ) ); d->pathCombo->addDefaultURL( u, KMimeType::pixmapForURL( u, 0, KIcon::Small ), text ); KURL docPath; docPath.setPath( KGlobalSettings::documentPath() ); if ( u.path(+1) != docPath.path(+1) ) { - text = i18n("Documents: %1").arg( docPath.path( +1 ) ); + text = i18n("Documents: %1").tqarg( docPath.path( +1 ) ); d->pathCombo->addDefaultURL( u, KMimeType::pixmapForURL( u, 0, KIcon::Small ), text ); } u.setPath( KGlobalSettings::desktopPath() ); - text = i18n("Desktop: %1").arg( u.path( +1 ) ); + text = i18n("Desktop: %1").tqarg( u.path( +1 ) ); d->pathCombo->addDefaultURL( u, KMimeType::pixmapForURL( u, 0, KIcon::Small ), text ); @@ -153,10 +153,10 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil // If local, check it exists. If not, go up until it exists. if ( d->url.isLocalFile() ) { - if ( !QFile::exists( d->url.path() ) ) + if ( !TQFile::exists( d->url.path() ) ) { d->url = d->url.upURL(); - QDir dir( d->url.path() ); + TQDir dir( d->url.path() ); while ( !dir.exists() ) { d->url = d->url.upURL(); @@ -167,14 +167,14 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil ops = new KDirOperator(d->url, d->mainWidget, "KFileDialog::ops"); ops->setOnlyDoubleClickSelectsFiles( true ); - connect(ops, SIGNAL(urlEntered(const KURL&)), - SLOT(urlEntered(const KURL&))); - connect(ops, SIGNAL(fileHighlighted(const KFileItem *)), - SLOT(fileHighlighted(const KFileItem *))); - connect(ops, SIGNAL(fileSelected(const KFileItem *)), - SLOT(fileSelected(const KFileItem *))); - connect(ops, SIGNAL(finishedLoading()), - SLOT(slotLoadingFinished())); + connect(ops, TQT_SIGNAL(urlEntered(const KURL&)), + TQT_SLOT(urlEntered(const KURL&))); + connect(ops, TQT_SIGNAL(fileHighlighted(const KFileItem *)), + TQT_SLOT(fileHighlighted(const KFileItem *))); + connect(ops, TQT_SIGNAL(fileSelected(const KFileItem *)), + TQT_SLOT(fileSelected(const KFileItem *))); + connect(ops, TQT_SIGNAL(finishedLoading()), + TQT_SLOT(slotLoadingFinished())); ops->setupMenu(KDirOperator::SortActions | KDirOperator::FileActions | @@ -183,9 +183,9 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil // plug nav items into the toolbar coll->action( "up" )->plug( toolbar ); - coll->action( "up" )->setWhatsThis(i18n("<qt>Click this button to enter the parent directory.<p>" + coll->action( "up" )->setWhatsThis(i18n("<qt>Click this button to enter the tqparent directory.<p>" "For instance, if the current location is file:/home/%1 clicking this " - "button will take you to file:/home.</qt>").arg(getlogin())); + "button will take you to file:/home.</qt>").tqarg(getlogin())); coll->action( "back" )->plug( toolbar ); coll->action( "back" )->setWhatsThis(i18n("Click this button to move backwards one step in the browsing history.")); coll->action( "forward" )->plug( toolbar ); @@ -197,24 +197,24 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil coll->action( "mkdir" )->setWhatsThis(i18n("Click this button to create a new directory.")); d->bookmarkHandler = new KFileBookmarkHandler( this ); - toolbar->insertButton(QString::fromLatin1("bookmark"), + toolbar->insertButton(TQString::tqfromLatin1("bookmark"), (int)HOTLIST_BUTTON, true, i18n("Bookmarks")); toolbar->getButton(HOTLIST_BUTTON)->setPopup( d->bookmarkHandler->menu(), true); - QWhatsThis::add(toolbar->getButton(HOTLIST_BUTTON), + TQWhatsThis::add(toolbar->getButton(HOTLIST_BUTTON), i18n("<qt>This button allows you to bookmark specific locations. " "Click on this button to open the bookmark menu where you may add, " "edit or select a bookmark.<p>" "These bookmarks are specific to the file dialog, but otherwise operate " "like bookmarks elsewhere in KDE.</qt>")); - connect( d->bookmarkHandler, SIGNAL( openURL( const QString& )), - SLOT( enterURL( const QString& ))); + connect( d->bookmarkHandler, TQT_SIGNAL( openURL( const TQString& )), + TQT_SLOT( enterURL( const TQString& ))); KToggleAction *showSidebarAction = new KToggleAction(i18n("Show Quick Access Navigation Panel"), Key_F9, coll,"toggleSpeedbar"); - connect( showSidebarAction, SIGNAL( toggled( bool ) ), - SLOT( toggleSpeedbar( bool )) ); + connect( showSidebarAction, TQT_SIGNAL( toggled( bool ) ), + TQT_SLOT( toggleSpeedbar( bool )) ); KActionMenu *menu = new KActionMenu( i18n("Configure"), "configure", this, "extra menu" ); menu->setWhatsThis(i18n("<qt>This is the configuration menu for the file dialog. " @@ -241,15 +241,15 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil menu->insert( coll->action( "separate dirs" )); menu->setDelayed( false ); - connect( menu->popupMenu(), SIGNAL( aboutToShow() ), - ops, SLOT( updateSelectionDependentActions() )); + connect( menu->popupMenu(), TQT_SIGNAL( aboutToShow() ), + ops, TQT_SLOT( updateSelectionDependentActions() )); menu->plug( toolbar ); */ /* * ugly little hack to have a 5 pixel space between the buttons * and the combo box */ -/* QWidget *spacerWidget = new QWidget(toolbar); +/* TQWidget *spacerWidget = new TQWidget(toolbar); //(js) spacerWidget->setMinimumWidth(spacingHint()); //(js) spacerWidget->setMaximumWidth(spacingHint()); d->m_pathComboIndex = toolbar->insertWidget(-1, -1, spacerWidget); @@ -264,21 +264,21 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil d->pathCombo->setCompletionObject( ops->dirCompletionObject(), false ); - connect( d->pathCombo, SIGNAL( urlActivated( const KURL& )), - this, SLOT( enterURL( const KURL& ) )); - connect( d->pathCombo, SIGNAL( returnPressed( const QString& )), - this, SLOT( enterURL( const QString& ) )); - connect( d->pathCombo, SIGNAL(textChanged( const QString& )), - SLOT( pathComboChanged( const QString& ) )); - connect( d->pathCombo, SIGNAL( completion( const QString& )), - SLOT( dirCompletion( const QString& ))); - connect( d->pathCombo, SIGNAL( textRotation(KCompletionBase::KeyBindingType) ), - d->pathCombo, SLOT( rotateText(KCompletionBase::KeyBindingType) )); + connect( d->pathCombo, TQT_SIGNAL( urlActivated( const KURL& )), + this, TQT_SLOT( enterURL( const KURL& ) )); + connect( d->pathCombo, TQT_SIGNAL( returnPressed( const TQString& )), + this, TQT_SLOT( enterURL( const TQString& ) )); + connect( d->pathCombo, TQT_SIGNAL(textChanged( const TQString& )), + TQT_SLOT( pathComboChanged( const TQString& ) )); + connect( d->pathCombo, TQT_SIGNAL( completion( const TQString& )), + TQT_SLOT( dirCompletion( const TQString& ))); + connect( d->pathCombo, TQT_SIGNAL( textRotation(KCompletionBase::KeyBindingType) ), + d->pathCombo, TQT_SLOT( rotateText(KCompletionBase::KeyBindingType) )); - QString whatsThisText; + TQString whatsThisText; // the Location label/edit - d->locationLabel = new QLabel(i18n("&Location:"), d->mainWidget); + d->locationLabel = new TQLabel(i18n("&Location:"), d->mainWidget); locationEdit = new KURLComboBox(KURLComboBox::Files, true, d->mainWidget, "LocationEdit"); updateLocationWhatsThis (); @@ -293,14 +293,14 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil // locationEdit->setAutoDeleteCompletionObject( true ); locationEdit->setCompletionObject( ops->completionObject(), false ); - connect( locationEdit, SIGNAL( returnPressed() ), - this, SLOT( slotOk())); - connect(locationEdit, SIGNAL( activated( const QString& )), - this, SLOT( locationActivated( const QString& ) )); - connect( locationEdit, SIGNAL( completion( const QString& )), - SLOT( fileCompletion( const QString& ))); - connect( locationEdit, SIGNAL( textRotation(KCompletionBase::KeyBindingType) ), - locationEdit, SLOT( rotateText(KCompletionBase::KeyBindingType) )); + connect( locationEdit, TQT_SIGNAL( returnPressed() ), + this, TQT_SLOT( slotOk())); + connect(locationEdit, TQT_SIGNAL( activated( const TQString& )), + this, TQT_SLOT( locationActivated( const TQString& ) )); + connect( locationEdit, TQT_SIGNAL( completion( const TQString& )), + TQT_SLOT( fileCompletion( const TQString& ))); + connect( locationEdit, TQT_SIGNAL( textRotation(KCompletionBase::KeyBindingType) ), + locationEdit, TQT_SLOT( rotateText(KCompletionBase::KeyBindingType) )); // the Filter label/edit whatsThisText = i18n("<qt>This is the filter to apply to the file list. " @@ -309,19 +309,19 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil "drop down menu, or you may enter a custom filter " "directly into the text area.<p>" "Wildcards such as * and ? are allowed.</qt>"); - d->filterLabel = new QLabel(i18n("&Filter:"), d->mainWidget); - QWhatsThis::add(d->filterLabel, whatsThisText); + d->filterLabel = new TQLabel(i18n("&Filter:"), d->mainWidget); + TQWhatsThis::add(d->filterLabel, whatsThisText); filterWidget = new KFileFilterCombo(d->mainWidget, "KFileDialog::filterwidget"); - QWhatsThis::add(filterWidget, whatsThisText); + TQWhatsThis::add(filterWidget, whatsThisText); setFilter(filter); d->filterLabel->setBuddy(filterWidget); - connect(filterWidget, SIGNAL(filterChanged()), SLOT(slotFilterChanged())); + connect(filterWidget, TQT_SIGNAL(filterChanged()), TQT_SLOT(slotFilterChanged())); // the Automatically Select Extension checkbox // (the text, visibility etc. is set in updateAutoSelectExtension(), which is called by readConfig()) - d->autoSelectExtCheckBox = new QCheckBox (d->mainWidget); - connect(d->autoSelectExtCheckBox, SIGNAL(clicked()), SLOT(slotAutoSelectExtClicked())); + d->autoSelectExtCheckBox = new TQCheckBox (d->mainWidget); + connect(d->autoSelectExtCheckBox, TQT_SIGNAL(clicked()), TQT_SLOT(slotAutoSelectExtClicked())); initGUI(); // activate GM @@ -342,7 +342,7 @@ void KexiStartupFileDialogBase::init(const QString& startDir, const QString& fil void KexiStartupFileDialogBase::clearFilter() { d->kde_filters = "";//(js) - QFileDialog::setFilter(""); //(js); + TQFileDialog::setFilter(""); //(js); //todo d->mimetypes.clear(); //todo d->hasDefaultFilter = false; @@ -356,15 +356,15 @@ KFile::Mode KexiStartupFileDialogBase::mode() const void KexiStartupFileDialogBase::setMode( KFile::Mode m ) { - //(js) translate mode for QFileDialog + //(js) translate mode for TQFileDialog d->mode = m; - QFileDialog::Mode qm = (QFileDialog::Mode)0; - if (m & KFile::File) qm = Mode(qm | QFileDialog::AnyFile); - else if (m & KFile::Directory) qm = Mode(qm | QFileDialog::DirectoryOnly); - if (m & KFile::Files) qm = Mode(qm | QFileDialog::ExistingFiles); - if (m & KFile::ExistingOnly) qm = Mode(qm | QFileDialog::ExistingFile); + TQFileDialog::Mode qm = (TQFileDialog::Mode)0; + if (m & KFile::File) qm = Mode(qm | TQFileDialog::AnyFile); + else if (m & KFile::Directory) qm = Mode(qm | TQFileDialog::DirectoryOnly); + if (m & KFile::Files) qm = Mode(qm | TQFileDialog::ExistingFiles); + if (m & KFile::ExistingOnly) qm = Mode(qm | TQFileDialog::ExistingFile); - QFileDialog::setMode( qm ); + TQFileDialog::setMode( qm ); /*(js) ops->setMode(m); if ( ops->dirOnlyMode() ) { //(js) filterWidget->setDefaultFilter( i18n("*|All Directories") ); @@ -395,35 +395,35 @@ void KexiStartupFileDialogBase::setOperationMode( KFileDialog::OperationMode mod updateAutoSelectExtension (); } -QString KexiStartupFileDialogBase::currentFilter() const +TQString KexiStartupFileDialogBase::currentFilter() const { //(js)filterWidget->currentFilter(); - //we need to convert Qt filter format to KDE format - //Qt format: "some text (*.first *.second)" or "All (*)" + //we need to convert TQt filter format to KDE format + //TQt format: "some text (*.first *.second)" or "All (*)" //KDE format: "*.first *.second" or "*" - QString f = selectedFilter(); - if (f.find('(')!=-1) - f = f.mid(f.find('(')+1); - if (f.mid(f.find(')')!=-1)) - f = f.left(f.find(')')); + TQString f = selectedFilter(); + if (f.tqfind('(')!=-1) + f = f.mid(f.tqfind('(')+1); + if (f.mid(f.tqfind(')')!=-1)) + f = f.left(f.tqfind(')')); return f; } -void KexiStartupFileDialogBase::setFilter(const QString& filter) +void KexiStartupFileDialogBase::setFilter(const TQString& filter) { d->kde_filters = filter; - int pos = d->kde_filters.find('/'); + int pos = d->kde_filters.tqfind('/'); // Check for an un-escaped '/', if found // interpret as a MIME filter. if (pos > 0 && filter[pos - 1] != '\\') { - QStringList filters = QStringList::split( " ", d->kde_filters ); + TQStringList filters = TQStringList::split( " ", d->kde_filters ); setMimeFilter( filters ); return; } - QFileDialog::setFilters( convertKFileDialogFilterToQFileDialogFilter(filter) ); + TQFileDialog::setFilters( convertKFileDialogFilterToTQFileDialogFilter(filter) ); //</js> //(js) ops->clearFilter(); //(js) filterWidget->setFilter(copy); @@ -434,14 +434,14 @@ void KexiStartupFileDialogBase::setFilter(const QString& filter) updateAutoSelectExtension (); } -void KexiStartupFileDialogBase::setMimeFilter( const QStringList& mimeTypes, - const QString& defaultType ) +void KexiStartupFileDialogBase::setMimeFilter( const TQStringList& mimeTypes, + const TQString& defaultType ) { d->mimetypes = mimeTypes; //(js) filterWidget->setMimeFilter( mimeTypes, defaultType ); -//(js) QStringList types = QStringList::split(" ", filterWidget->currentFilter()); -//(js) types.append( QString::fromLatin1( "inode/directory" )); +//(js) TQStringList types = TQStringList::split(" ", filterWidget->currentFilter()); +//(js) types.append( TQString::tqfromLatin1( "inode/directory" )); //(js) ops->clearFilter(); //(js) ops->setMimeFilter( types ); //(js) d->hasDefaultFilter = !defaultType.isEmpty(); @@ -451,25 +451,25 @@ void KexiStartupFileDialogBase::setMimeFilter( const QStringList& mimeTypes, //TODO updateAutoSelectExtension (); } -QString KexiStartupFileDialogBase::realStartDir(const QString& startDir) +TQString KexiStartupFileDialogBase::realStartDir(const TQString& startDir) { if (!startDir.startsWith(":")) return startDir; - QString recentDir; //dummy - QString path( KFileDialog::getStartURL(startDir, recentDir).path() ); + TQString recentDir; //dummy + TQString path( KFileDialog::getStartURL(startDir, recentDir).path() ); if (path.isEmpty()) - return QString::null; - QFileInfo fi(path); + return TQString(); + TQFileInfo fi(path); return fi.isDir() ? fi.absFilePath() : fi.dir(true).absPath(); } -void KexiStartupFileDialogBase::saveLastVisitedPath(const QString& path) +void KexiStartupFileDialogBase::saveLastVisitedPath(const TQString& path) { if (!m_lastVisitedPathsVariable.isEmpty()) { //save last visited dir path -// QString dir = QDir(path).absPath(); - QFileInfo fi(path); - QString dir( fi.isDir() ? fi.absFilePath() : fi.dir(true).absPath() ); +// TQString dir = TQDir(path).absPath(); + TQFileInfo fi(path); + TQString dir( fi.isDir() ? fi.absFilePath() : fi.dir(true).absPath() ); if (!dir.isEmpty()) KRecentDirs::add(m_lastVisitedPathsVariable, dir); } |