Commit 00d105af authored by David Faure's avatar David Faure

I declare war against C-style casts. Too bad X11/Xatom.h forces me to surrender though.

svn path=/trunk/KDE/kdebase/apps/; revision=1098636
parent 72ff06df
......@@ -60,7 +60,7 @@ KonqClosedItem::~KonqClosedItem()
}
KonqClosedTabItem::KonqClosedTabItem(const QString& url, const QString& title, int pos, quint64 serialNumber)
: KonqClosedItem(title, "Closed_Tab" + QString::number((qint64)this), serialNumber), m_url(url), m_pos(pos)
: KonqClosedItem(title, "Closed_Tab" + QString::number(reinterpret_cast<qint64>(this)), serialNumber), m_url(url), m_pos(pos)
{
kDebug() << m_configGroup.name();
}
......@@ -76,7 +76,7 @@ QPixmap KonqClosedTabItem::icon() const {
}
KonqClosedWindowItem::KonqClosedWindowItem(const QString& title, quint64 serialNumber, int numTabs)
: KonqClosedItem(title, "Closed_Window" + QString::number((qint64)this), serialNumber), m_numTabs(numTabs)
: KonqClosedItem(title, "Closed_Window" + QString::number(reinterpret_cast<qint64>(this)), serialNumber), m_numTabs(numTabs)
{
kDebug() << m_configGroup.name();
}
......
......@@ -487,7 +487,7 @@ void KonqCombo::selectWord(QKeyEvent *e)
count++;
if( allow_space_break && text[pos].isSpace() )
break;
} while( pos < (int) text.length() && chars.indexOf(text[pos]) == -1 );
} while( pos < text.length() && chars.indexOf(text[pos]) == -1 );
if( e->modifiers() & Qt::ShiftModifier ) {
edit->cursorForward(true, count+1);
......@@ -925,7 +925,7 @@ void KonqComboCompletionBox::setItems( const QStringList& items )
for ( ; it != itEnd; ++it) {
if ( rowIndex < count() ) {
const bool changed = ((KonqListWidgetItem*)item(rowIndex))->reuse( *it );
const bool changed = (static_cast<KonqListWidgetItem*>(item(rowIndex)))->reuse( *it );
dirty = dirty || changed;
}
else {
......
......@@ -64,7 +64,7 @@ KonqFrameContainer::~KonqFrameContainer()
void KonqFrameContainer::saveConfig( KConfigGroup& config, const QString &prefix, const KonqFrameBase::Options &options, KonqFrameBase* docContainer, int id, int depth )
{
int idSecond = id + (int)pow( 2.0, depth );
int idSecond = id + int(pow( 2.0, depth ));
//write children sizes
config.writeEntry( QString::fromLatin1( "SplitterSizes" ).prepend( prefix ), sizes() );
......
......@@ -132,7 +132,7 @@ QVariant HistoryEntry::data(int role, int /*column*/) const
case Qt::ToolTipRole:
return entry.url.url();
case KonqHistory::TypeRole:
return (int)KonqHistory::HistoryType;
return int(KonqHistory::HistoryType);
case KonqHistory::DetailedToolTipRole:
return i18n("<qt><center><b>%1</b></center><hr />Last visited: %2<br />"
"First visited: %3<br />Number of times visited: %4</qt>",
......@@ -181,7 +181,7 @@ QVariant GroupEntry::data(int role, int /*column*/) const
case Qt::DecorationRole:
return icon;
case KonqHistory::TypeRole:
return (int)KonqHistory::GroupType;
return int(KonqHistory::GroupType);
case KonqHistory::LastVisitedRole: {
if (entries.isEmpty()) {
return QDateTime();
......
......@@ -60,18 +60,18 @@ QVariant KonqHistoryProxyModel::data(const QModelIndex &index, int role) const
QDateTime dt;
if (m_settings->m_metricYoungerThan == KonqHistorySettings::DAYS) {
dt = current.addDays(-(int)m_settings->m_valueYoungerThan);
dt = current.addDays(-int(m_settings->m_valueYoungerThan));
} else {
dt = current.addSecs(-((int)m_settings->m_valueYoungerThan * 60));
dt = current.addSecs(-(int(m_settings->m_valueYoungerThan) * 60));
}
if (entryDate > dt) {
res = qVariantFromValue(m_settings->m_fontYoungerThan);
} else {
if (m_settings->m_metricOlderThan == KonqHistorySettings::DAYS) {
dt = current.addDays(-(int)m_settings->m_valueOlderThan);
dt = current.addDays(-int(m_settings->m_valueOlderThan));
} else {
dt = current.addSecs(-((int)m_settings->m_valueOlderThan * 60));
dt = current.addSecs(-(int(m_settings->m_valueOlderThan) * 60));
}
if (entryDate < dt) {
res = qVariantFromValue(m_settings->m_fontOlderThan);
......
......@@ -239,7 +239,7 @@ KonqMainWindow::KonqMainWindow( const KUrl &initialURL, const QString& xmluiFile
// setup the completion object before createGUI(), so that the combo
// picks up the correct mode from the HistoryManager (in slotComboPlugged)
int mode = KonqSettings::settingsCompletionMode();
s_pCompletion->setCompletionMode( (KGlobalSettings::Completion) mode );
s_pCompletion->setCompletionMode( static_cast<KGlobalSettings::Completion>(mode) );
}
connect(KParts::HistoryProvider::self(), SIGNAL(cleared()), SLOT(slotClearComboHistory()));
......@@ -443,7 +443,7 @@ QString KonqMainWindow::detectNameFilter( KUrl & url )
int lastSlash = path.lastIndexOf( '/' );
if ( lastSlash > -1 )
{
if ( !url.query().isEmpty() && lastSlash == (int)path.length()-1 ) { // In /tmp/?foo, foo isn't a query
if ( !url.query().isEmpty() && lastSlash == path.length()-1 ) { // In /tmp/?foo, foo isn't a query
path += url.query(); // includes the '?'
url.setQuery( QString() );
}
......@@ -2880,7 +2880,7 @@ void KonqMainWindow::slotClosedItemsListAboutToShow()
popup->clear();
QAction* clearAction = popup->addAction( i18nc("This menu entry empties the closed items history", "Empty Closed Items History") );
connect(clearAction, SIGNAL(triggered()), m_pUndoManager, SLOT(clearClosedItemsList()));
popup->insertSeparator((QAction*)0);
popup->insertSeparator(static_cast<QAction*>(0));
QList<KonqClosedItem *>::ConstIterator it =
m_pUndoManager->closedItemsList().constBegin();
......@@ -2907,7 +2907,7 @@ void KonqMainWindow::slotSessionsListAboutToShow()
connect(saveSessionAction, SIGNAL(triggered()), this, SLOT(saveCurrentSession()));
QAction* manageSessionsAction = popup->addAction( KIcon("view-choose"), i18n("Manage...") );
connect(manageSessionsAction, SIGNAL(triggered()), this, SLOT(manageSessions()));
popup->insertSeparator((QAction*)0);
popup->insertSeparator(static_cast<QAction*>(0));
QString dir= KStandardDirs::locateLocal("appdata", "sessions/");
QDirIterator it(dir, QDir::Readable|QDir::NoDotAndDotDot|QDir::Dirs);
......@@ -3058,7 +3058,7 @@ void KonqMainWindow::slotCompletionModeChanged( KGlobalSettings::Completion m )
{
s_pCompletion->setCompletionMode( m );
KonqSettings::setSettingsCompletionMode( (int)m_combo->completionMode() );
KonqSettings::setSettingsCompletionMode( int(m_combo->completionMode()) );
KonqSettings::self()->writeConfig();
// tell the other windows too (only this instance currently)
......@@ -4519,7 +4519,7 @@ void KonqMainWindow::slotPopupMenu( const QPoint &global, const KFileItemList &i
// This action collection is used to pass actions to KonqPopupMenu.
// It has to be a KActionCollection instead of a KActionPtrList because we need
// the actionStatusText signal...
KActionCollection popupMenuCollection( (QWidget*)0 );
KActionCollection popupMenuCollection( static_cast<QWidget*>(0) );
// m_paBack is a submenu, for the toolbar & edit menu "back",
// but in the RMB we want a simple one-click back instead.
......@@ -5585,7 +5585,7 @@ void KonqMainWindow::resetWindow()
// empty append to get current X timestamp
QWidget tmp_widget;
XChangeProperty( QX11Info::display(), tmp_widget.winId(), XA_WM_CLASS, XA_STRING, 8,
PropModeAppend, (unsigned char*) &data, 0 );
PropModeAppend, reinterpret_cast<unsigned char*>(&data), 0 );
XEvent ev;
XWindowEvent( QX11Info::display(), tmp_widget.winId(), PropertyChangeMask, &ev );
long x_time = ev.xproperty.time;
......@@ -5594,7 +5594,7 @@ void KonqMainWindow::resetWindow()
// (shows mainly with 'konqueror --preload')
static Atom atom = XInternAtom( QX11Info::display(), "_KDE_NET_WM_USER_CREATION_TIME", False );
XChangeProperty( QX11Info::display(), winId(), atom, XA_CARDINAL, 32,
PropModeReplace, (unsigned char *) &x_time, 1);
PropModeReplace, reinterpret_cast<unsigned char *>(&x_time), 1);
// reset also user time, so that this window won't have _NET_WM_USER_TIME set
QX11Info::setAppUserTime(CurrentTime);
......
......@@ -668,7 +668,7 @@ void KonqView::setIconURL( const KUrl & iconURL )
void KonqView::setPageSecurity( int pageSecurity )
{
m_pageSecurity = (KonqMainWindow::PageSecurity)pageSecurity;
m_pageSecurity = static_cast<KonqMainWindow::PageSecurity>(pageSecurity);
if ( m_pMainWindow->currentView() == this )
m_pMainWindow->setPageSecurity( m_pageSecurity );
......@@ -1286,7 +1286,7 @@ void HistoryEntry::saveConfig( KConfigGroup& config, const QString &prefix, cons
config.writeEntry( QString::fromLatin1( "PostContentType" ).prepend( prefix ), postContentType );
config.writeEntry( QString::fromLatin1( "DoPost" ).prepend( prefix ), doPost );
config.writeEntry( QString::fromLatin1( "PageReferrer" ).prepend( prefix ), pageReferrer );
config.writeEntry( QString::fromLatin1( "PageSecurity" ).prepend( prefix ), (int)pageSecurity );
config.writeEntry( QString::fromLatin1( "PageSecurity" ).prepend( prefix ), static_cast<int>(pageSecurity) );
}
}
......@@ -1311,7 +1311,8 @@ void HistoryEntry::loadItem( const KConfigGroup& config, const QString &prefix,
postContentType = config.readEntry( QString::fromLatin1( "PostContentType" ).prepend( prefix ), "" );
doPost = config.readEntry( QString::fromLatin1( "DoPost" ).prepend( prefix ), false );
pageReferrer = config.readEntry( QString::fromLatin1( "PageReferrer" ).prepend( prefix ), "" );
pageSecurity = (KonqMainWindow::PageSecurity)config.readEntry( QString::fromLatin1( "PageSecurity" ).prepend( prefix ), 0 );
pageSecurity = static_cast<KonqMainWindow::PageSecurity>(config.readEntry(
QString::fromLatin1( "PageSecurity" ).prepend( prefix ), 0 ));
reload = false;
}
}
......
......@@ -1037,7 +1037,7 @@ void KonqViewManager::doSetActivePart( KParts::Part *part )
}
// Don't activate when part changed in non-active tab
KonqView* partView = m_pMainWindow->childView((KParts::ReadOnlyPart*)part);
KonqView* partView = m_pMainWindow->childView(static_cast<KParts::ReadOnlyPart*>(part));
if (partView)
{
KonqFrameContainerBase* parentContainer = partView->frame()->parentContainer();
......
......@@ -91,7 +91,7 @@ void HistoryManagerTest::testAddHistoryEntry()
QCOMPARE( entry.url.url(), url.url() );
QCOMPARE( entry.typedUrl, typedUrl );
QCOMPARE( entry.title, QString() ); // not set yet, still pending
QCOMPARE( (int)entry.numberOfTimesVisited, 1 );
QCOMPARE( int(entry.numberOfTimesVisited), 1 );
// Now confirm it
mgr.confirmPending( url, typedUrl, title );
......@@ -107,7 +107,7 @@ void HistoryManagerTest::testAddHistoryEntry()
QCOMPARE( entry.url.url(), url.url() );
QCOMPARE( entry.typedUrl, typedUrl );
QCOMPARE( entry.title, title ); // now it's there
QCOMPARE( (int)entry.numberOfTimesVisited, 1 );
QCOMPARE( int(entry.numberOfTimesVisited), 1 );
// Now clean it up
......@@ -123,5 +123,5 @@ void HistoryManagerTest::testAddHistoryEntry()
QCOMPARE( entry.url.url(), url.url() );
QCOMPARE( entry.typedUrl, typedUrl );
QCOMPARE( entry.title, title );
QCOMPARE( (int)entry.numberOfTimesVisited, 1 );
QCOMPARE( int(entry.numberOfTimesVisited), 1 );
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment