Adapt to new kde4 api

Remove some qt3support

svn path=/trunk/KDE/kdebase/konqueror/; revision=478902
This commit is contained in:
Laurent Montel 2005-11-08 10:20:07 +00:00
parent a9954e00d0
commit 7254bdfcd8
21 changed files with 49 additions and 46 deletions

View file

@ -158,7 +158,7 @@ void ChFaceDlg::slotGetCustomImage( )
{
QCheckBox* checkWidget = new QCheckBox( i18n("&Save copy in custom faces folder for future use"), 0 );
KFileDialog *dlg = new KFileDialog( QDir::homeDirPath(), KImageIO::pattern( KImageIO::Reading ),
KFileDialog *dlg = new KFileDialog( QDir::homePath(), KImageIO::pattern( KImageIO::Reading ),
this, 0, true, checkWidget);
dlg->setOperationMode( KFileDialog::Opening );
@ -178,7 +178,7 @@ void ChFaceDlg::slotSaveCustomImage()
{
if ( m_FacesWidget->currentItem()->key() == USER_CUSTOM_KEY)
{
QDir userfaces( QDir::homeDirPath() + USER_FACES_DIR );
QDir userfaces( QDir::homePath() + USER_FACES_DIR );
if ( !userfaces.exists( ) )
userfaces.mkdir( userfaces.absolutePath() );

View file

@ -410,7 +410,7 @@ void KfindTabWidget::setURL( const KURL & url )
else {
QDir m_dir("/lib");
dirBox ->insertItem( m_url.url() );
dirBox ->insertItem( "file:" + QDir::homeDirPath() );
dirBox ->insertItem( "file:" + QDir::homePath() );
dirBox ->insertItem( "file:/" );
dirBox ->insertItem( "file:/usr" );
if (m_dir.exists())
@ -492,7 +492,7 @@ void KfindTabWidget::loadHistory()
else {
QDir m_dir("/lib");
dirBox ->insertItem( m_url.url() );
dirBox ->insertItem( "file:" + QDir::homeDirPath() );
dirBox ->insertItem( "file:" + QDir::homePath() );
dirBox ->insertItem( "file:/" );
dirBox ->insertItem( "file:/usr" );
if (m_dir.exists())

View file

@ -53,9 +53,9 @@ int main( int argc, char ** argv )
if (args->count() > 0)
url = args->url(0);
if (url.isEmpty())
url = QDir::currentDirPath();
url = QDir::currentPath();
if (url.isEmpty())
url = QDir::homeDirPath();
url = QDir::homePath();
args->clear();
KfindDlg kfinddlg(url, 0, "dialog");

View file

@ -104,7 +104,7 @@ QString KonqAboutPageFactory::launch()
QString wastebin_icon_path = iconloader->iconPath("trashcan_full", KIcon::Desktop );
QString applications_icon_path = iconloader->iconPath("kmenu", KIcon::Desktop );
QString settings_icon_path = iconloader->iconPath("kcontrol", KIcon::Desktop );
QString home_folder = QDir::homeDirPath();
QString home_folder = QDir::homePath();
QString continue_icon_path = QApplication::reverseLayout()?iconloader->iconPath("1leftarrow", KIcon::Small ):iconloader->iconPath("1rightarrow", KIcon::Small );
res = res.arg( locate( "data", "kdeui/about/kde_infopage.css" ) );

View file

@ -1405,7 +1405,7 @@ void KonqKfmIconView::setupSortKeys()
QString KonqKfmIconView::makeSizeKey( KFileIVI *item )
{
return KIO::number( item->item()->size() ).rightJustify( 20, '0' );
return KIO::number( item->item()->size() ).rightJustified( 20, '0' );
}
void KonqKfmIconView::disableIcons( const KURL::List & lst )

View file

@ -401,7 +401,7 @@ bool KonqFrame::eventFilter(QObject* /*obj*/, QEvent *ev)
if (ev->type()==QEvent::KeyPress)
{
QKeyEvent * keyEv = static_cast<QKeyEvent*>(ev);
if ((keyEv->key()==Qt::Key_Tab) && (keyEv->modifiers()==Qt::ControlButton))
if ((keyEv->key()==Qt::Key_Tab) && (keyEv->modifiers()==Qt::ControlModifier))
{
emit ((KonqFrameContainer*)parent())->ctrlTabPressed();
return true;

View file

@ -280,7 +280,7 @@ KonqMainWindow::KonqMainWindow( const KURL &initialURL, bool openInitialURL, con
else if ( openInitialURL )
{
KURL homeURL;
homeURL.setPath( QDir::homeDirPath() );
homeURL.setPath( QDir::homePath() );
openURL( 0L, homeURL );
}
else
@ -1377,7 +1377,7 @@ void KonqMainWindow::slotOpenTerminal()
{
QString term = KonqSettings::terminalApplication();
QString dir ( QDir::homeDirPath() );
QString dir ( QDir::homePath() );
//Try to get the directory of the current view
if ( m_currentView )
@ -1429,7 +1429,7 @@ void KonqMainWindow::slotOpenLocation()
dlg.exec();
const KURL& url = dlg.selectedURL();
if (!url.isEmpty())
openFilteredURL( url.url().stripWhiteSpace() );
openFilteredURL( url.url().trimmed() );
}
void KonqMainWindow::slotToolFind()
@ -1470,7 +1470,7 @@ void KonqMainWindow::slotToolFind()
if ( m_currentView && m_currentView->url().isLocalFile() )
url = m_currentView->locationBarURL();
else
url.setPath( QDir::homeDirPath() );
url.setPath( QDir::homePath() );
KonqMainWindow * mw = KonqMisc::createBrowserWindowFromProfile(
locate( "data", QLatin1String("konqueror/profiles/filemanagement") ),
"filemanagement", url, KParts::URLArgs(), true /* forbid "use html"*/ );
@ -2527,10 +2527,10 @@ void KonqMainWindow::slotURLEntered( const QString &text, int state )
if (state & Qt::ControlModifier || state & Qt::AltModifier)
{
m_combo->setURL( m_currentView ? m_currentView->url().prettyURL() : QString::null );
openFilteredURL( text.stripWhiteSpace(), true );
openFilteredURL( text.trimmed(), true );
}
else
openFilteredURL( text.stripWhiteSpace() );
openFilteredURL( text.trimmed() );
m_bURLEnterLock = false;
}
@ -5617,7 +5617,7 @@ bool KonqMainWindow::isMimeTypeAssociatedWithSelf( const QString &/*mimeType*/,
// 1) force embedding first, if that works we're ok
// 2) check what KRun is going to do before calling it.
return ( offer && ( offer->desktopEntryName() == "konqueror" ||
offer->exec().stripWhiteSpace().startsWith( "kfmclient" ) ) );
offer->exec().trimmed().startsWith( "kfmclient" ) ) );
}
// KonqFrameContainerBase implementation END
@ -5772,7 +5772,7 @@ static int current_memory_usage( int* limit )
while (!f.atEnd())
{
line = f.readLine();
line = line.stripWhiteSpace();
line = line.trimmed();
int usage = line.section( ' ', 0, 0 ).toInt();
if( usage > 0 )
{

View file

@ -77,7 +77,7 @@ KonqMainWindow * KonqMisc::createSimpleWindow( const KURL & _url, const QString
// If _url is 0L, open $HOME [this doesn't happen anymore]
KURL url;
if (_url.isEmpty())
url.setPath(QDir::homeDirPath());
url.setPath(QDir::homePath());
else
url = _url;

View file

@ -409,7 +409,7 @@ void KonqFrameTabs::refreshSubPopupMenuTab()
KonqFrame* frame = dynamic_cast<KonqFrame *>(it);
if ( frame && frame->activeChildView() )
{
QString title = frame->title().stripWhiteSpace();
QString title = frame->title().trimmed();
if ( title.isEmpty() )
title = frame->activeChildView()->url().url();
title = KStringHandler::csqueeze( title, 50 );

View file

@ -133,7 +133,7 @@ void KonqInfoListViewItem::gotMetaInfo()
if (!kfmii.isValid())
continue;
QString s = kfmii.string().simplifyWhiteSpace();
QString s = kfmii.string().simplified();
setText(i, s.isNull() ? QString("") : s);
}
}

View file

@ -370,7 +370,7 @@ void KonqInfoListViewWidget::determineCounts(const KFileItemList& list)
// insert the icons
// for (int i=0; i<menu->count(); ++i)
// {
// menu->changeItem(i, QIconSet(blah));
// menu->changeItem(i, QIcon(blah));
// }
if (m_favorite.mimetype)

View file

@ -176,7 +176,7 @@ void ListViewBrowserExtension::rename()
QString pattern;
KMimeType::diagnoseFileName( txt, pattern );
if (!pattern.isEmpty() && pattern.at(0)=='*' && pattern.find('*',1)==-1)
le->setSelection(0, txt.length()-pattern.stripWhiteSpace().length()+1);
le->setSelection(0, txt.length()-pattern.trimmed().length()+1);
else
{
int lastDot = txt.lastIndexOf('.');

View file

@ -49,12 +49,12 @@ int KonqTextViewItem::compare( Q3ListViewItem *item, int col, bool ascending ) c
|| (cInfo->udsId==KIO::UDS_ACCESS_TIME)
|| (cInfo->udsId==KIO::UDS_CREATION_TIME))
{
tmp += QString::number( m_fileitem->time(cInfo->udsId) ).rightJustify( 14, '0' );
tmp += QString::number( m_fileitem->time(cInfo->udsId) ).rightJustified( 14, '0' );
return tmp;
}
else if (cInfo->udsId==KIO::UDS_SIZE)
{
tmp += KIO::number( m_fileitem->size() ).rightJustify( 20, '0' );
tmp += KIO::number( m_fileitem->size() ).rightJustified( 20, '0' );
return tmp;
}
else break;

View file

@ -35,6 +35,7 @@
#include "socks.h"
#include <kaboutdata.h>
#include <kglobal.h>
KSocksConfig::KSocksConfig(KInstance *inst, QWidget *parent)
: KCModule(inst, parent)
@ -196,7 +197,7 @@ void KSocksConfig::libSelection()
void KSocksConfig::load()
{
KConfigGroup config(kapp->config(), "Socks");
KConfigGroup config(KGlobal::config(), "Socks");
base->_c_enableSocks->setChecked(config.readBoolEntry("SOCKS_enable", false));
int id = config.readNumEntry("SOCKS_method", 1);
base->bg->setButton(id);
@ -230,7 +231,7 @@ void KSocksConfig::load()
void KSocksConfig::save()
{
KConfigGroup config(kapp->config(), "Socks");
KConfigGroup config(KGlobal::config(), "Socks");
config.writeEntry("SOCKS_enable",base-> _c_enableSocks->isChecked(), true, true);
config.writeEntry("SOCKS_method", base->bg->id(base->bg->selected()), true, true);
config.writePathEntry("SOCKS_lib", base->_c_customPath->url(), true, true);
@ -243,7 +244,7 @@ void KSocksConfig::save()
}
config.writePathEntry("SOCKS_lib_path", libs, ',', true, true);
kapp->config()->sync();
KGlobal::config()->sync();
emit changed(false);
}

View file

@ -161,7 +161,7 @@ KWrite::~KWrite()
delete m_view->document();
}
kapp->config()->sync ();
KGlobal::config()->sync ();
}
void KWrite::setupActions()
@ -431,13 +431,13 @@ void KWrite::writeConfig(KConfig *config)
//config file
void KWrite::readConfig()
{
KConfig *config = kapp->config();
KConfig *config = KGlobal::config();
readConfig(config);
}
void KWrite::writeConfig()
{
KConfig *config = kapp->config();
KConfig *config = KGlobal::config();
writeConfig(config);
}

View file

@ -213,8 +213,8 @@ void KFileIVI::setThumbnailPixmap( const QPixmap & pixmap )
{
m_bThumbnail = true;
d->thumb = pixmap;
// QIconSet::reset() doesn't seem to clear the other generated pixmaps,
// so we just create a blank QIconSet here
// QIcon::reset() doesn't seem to clear the other generated pixmaps,
// so we just create a blank QIcon here
d->icons = QIcon();
d->icons.addPixmap( KGlobal::iconLoader()->iconEffect()->
apply( pixmap, KIcon::Desktop, KIcon::DefaultState ), QIcon::Normal );

View file

@ -67,6 +67,7 @@
#include <QX11Info>
#endif
#include <kauthorized.h>
#include <kglobal.h>
KBookmarkManager * KonqBookmarkManager::s_bookmarkManager;
@ -300,7 +301,7 @@ bool KonqOperations::askDeleteConfirmation( const KURL::List & selectedURLs, int
if (!keyName.isEmpty())
{
// Check kmessagebox setting... erase & copy to konquerorrc.
KConfig *config = kapp->config();
KConfig *config = KGlobal::config();
KConfigGroup saver(config, "Notification Messages");
if (!saver.readBoolEntry(keyName, true))
{

View file

@ -48,6 +48,7 @@
#include "konq_operations.h"
#include <dcopclient.h>
#include <kauthorized.h>
#include <kglobal.h>
/*
Test cases:
@ -319,7 +320,7 @@ bool KonqPopupMenu::KIOSKAuthorizedAction(KConfig& cfg)
it != list.end();
++it)
{
if (!KAuthorized::authorize((*it).stripWhiteSpace()))
if (!KAuthorized::authorize((*it).trimmed()))
{
return false;
}
@ -565,7 +566,7 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
addDel = true;
}
else {
KConfigGroup configGroup( kapp->config(), "KDE" );
KConfigGroup configGroup( KGlobal::config(), "KDE" );
if ( configGroup.readBoolEntry( "ShowDeleteCommand", false ) )
addDel = true;
}

View file

@ -211,8 +211,8 @@ void NSPluginLoader::scanPlugins()
}
QStringList desc = QStringList::split(':', line, TRUE);
QString mime = desc[0].stripWhiteSpace();
QStringList suffixes = QStringList::split(',', desc[1].stripWhiteSpace());
QString mime = desc[0].trimmed();
QStringList suffixes = QStringList::split(',', desc[1].trimmed());
if (!mime.isEmpty())
{
// insert the mimetype -> plugin mapping
@ -223,7 +223,7 @@ void NSPluginLoader::scanPlugins()
for (suffix = suffixes.begin(); suffix != suffixes.end(); ++suffix) {
// strip whitspaces and any preceding '.'
QString stripped = (*suffix).stripWhiteSpace();
QString stripped = (*suffix).trimmed();
int p=0;
for ( ; p<stripped.length() && stripped[p]=='.'; p++ );

View file

@ -120,7 +120,7 @@ void deletePluginMimeTypes()
// check all mime types for X-KDE-nsplugin flag
kdDebug(1433) << " - Looking in " << dirs[i] << endl;
QDir files( dirs.absFilePath(dirs[i]), QString::null,
QDir files( dirs.absoluteFilePath(dirs[i]), QString::null,
QDir::Name|QDir::IgnoreCase, QDir::Files );
if ( files.exists( dir ) ) {
@ -128,7 +128,7 @@ void deletePluginMimeTypes()
// check .desktop file
kdDebug(1433) << " - Checking " << files[i] << endl;
if ( isPluginMimeType(files.absFilePath(files[i])) ) {
if ( isPluginMimeType(files.absoluteFilePath(files[i])) ) {
kdDebug(1433) << " - Removing " << files[i] << endl;
files.remove( files[i] );
}
@ -176,7 +176,7 @@ void generateMimeType( QString mime, QString extensions, QString pluginName, QSt
QStringList exts = QStringList::split(",", extensions);
QStringList patterns;
for (QStringList::Iterator it=exts.begin(); it != exts.end(); ++it)
patterns.append( "*." + (*it).stripWhiteSpace() );
patterns.append( "*." + (*it).trimmed() );
ts << "Patterns=" << patterns.join( ";" ) << endl;
}
@ -321,7 +321,7 @@ void scanDirectory( QString dir, QStringList &mimeInfoList,
continue;
// get absolute file path
QString absFile = files.absFilePath( files[i] );
QString absFile = files.absoluteFilePath( files[i] );
kdDebug(1433) << "Checking library " << absFile << endl;
// open the library and ask for the mimetype
@ -425,7 +425,7 @@ void scanDirectory( QString dir, QStringList &mimeInfoList,
depth++;
for ( unsigned int i=0; i<dirs.count(); i++ ) {
if ( depth<8 && !dirs[i].contains(".") )
scanDirectory( dirs.absFilePath(dirs[i]), mimeInfoList, cache );
scanDirectory( dirs.absoluteFilePath(dirs[i]), mimeInfoList, cache );
}
depth--;
@ -512,7 +512,7 @@ void removeExistingExtensions( QString &extension )
QStringList filtered;
QStringList exts = QStringList::split( ",", extension );
for ( QStringList::Iterator it=exts.begin(); it!=exts.end(); ++it ) {
QString ext = (*it).stripWhiteSpace();
QString ext = (*it).trimmed();
if ( ext == "*" ) // some plugins have that, but we don't want to associate a mimetype with *.*!
continue;

View file

@ -315,7 +315,7 @@ NPError g_NPN_PostURLNotify(NPP instance, const char* url, const char* target,
break;
}
QString thisLine = QString::fromLatin1(previousStart, &buf[l-1] - previousStart).stripWhiteSpace();
QString thisLine = QString::fromLatin1(previousStart, &buf[l-1] - previousStart).trimmed();
previousStart = &buf[l];
previousCR = true;
@ -412,7 +412,7 @@ NPError g_NPN_PostURL(NPP instance, const char* url, const char* target,
break;
}
QString thisLine = QString::fromLatin1(previousStart, &buf[l-1] - previousStart).stripWhiteSpace();
QString thisLine = QString::fromLatin1(previousStart, &buf[l-1] - previousStart).trimmed();
previousStart = &buf[l];
previousCR = true;