Commit 9a87bc1b authored by Daniele E. Domenichelli's avatar Daniele E. Domenichelli
Browse files

Cleanup tabs

parent aa036a7e
......@@ -66,7 +66,7 @@ void TextChatConfig::sync()
QString mode;
if (d->m_openMode == TextChatConfig::NewWindow) {
mode = QLatin1String("NewWindow");
mode = QLatin1String("NewWindow");
} else {
mode = QLatin1String("FirstWindow");
}
......
......@@ -43,7 +43,7 @@ void ConversationDatePicker::setEntity(const Tp::AccountPtr &account, const Tpl:
if (!m_searchHits.isEmpty()) {
setDatesFromSearchHits();
updatePaintedDates();
Q_EMIT dateChanged(date());
Q_EMIT dateChanged(date());
} else {
Tpl::LogManagerPtr logManager = Tpl::LogManager::instance();
Tpl::PendingDates *pendingDates = logManager->queryDates(account, entity, Tpl::EventTypeMaskText);
......@@ -132,9 +132,9 @@ void ConversationDatePicker::setDatesFromSearchHits()
}
Q_FOREACH (const Tpl::SearchHit &searchHit, m_searchHits) {
if (searchHit.account().isNull() || searchHit.target().isNull()) {
continue;
}
if (searchHit.account().isNull() || searchHit.target().isNull()) {
continue;
}
if ((searchHit.account()->uniqueIdentifier() == m_account->uniqueIdentifier()) &&
(searchHit.target()->identifier() == m_entity->identifier())) {
......
......@@ -54,8 +54,8 @@
Q_DECLARE_METATYPE(QModelIndex)
LogViewer::LogViewer(const Tp::AccountFactoryPtr &accountFactory, const Tp::ConnectionFactoryPtr &connectionFactory,
const Tp::ChannelFactoryPtr &channelFactory, const Tp::ContactFactoryPtr &contactFactory,
QWidget *parent):
const Tp::ChannelFactoryPtr &channelFactory, const Tp::ContactFactoryPtr &contactFactory,
QWidget *parent):
KXmlGuiWindow(parent),
ui(new Ui::LogViewer)
{
......@@ -153,7 +153,7 @@ void LogViewer::onEntitySelected(const QModelIndex &current, const QModelIndex &
/* Ignore account nodes */
if (current.parent() == QModelIndex()) {
actionCollection()->action(QLatin1String("clear-contact-logs"))->setEnabled(false);
actionCollection()->action(QLatin1String("clear-contact-logs"))->setEnabled(false);
return;
}
......@@ -161,7 +161,7 @@ void LogViewer::onEntitySelected(const QModelIndex &current, const QModelIndex &
Tp::AccountPtr account = current.data(EntityModel::AccountRole).value<Tp::AccountPtr>();
if (!account.isNull() && !entity.isNull()) {
actionCollection()->action(QLatin1String("clear-contact-logs"))->setEnabled(true);
actionCollection()->action(QLatin1String("clear-contact-logs"))->setEnabled(true);
}
ui->datePicker->setEntity(account, entity);
......@@ -271,7 +271,7 @@ void LogViewer::slotClearAccountHistory()
/* Usually and account node is selected, so traverse up to it's parent
* account node */
if (index.parent().isValid()) {
index = index.parent();
index = index.parent();
}
if (!index.isValid()) {
......@@ -280,7 +280,7 @@ void LogViewer::slotClearAccountHistory()
Tp::AccountPtr account = index.data(EntityModel::AccountRole).value<Tp::AccountPtr>();
if (account.isNull()) {
return;
return;
}
if (KMessageBox::questionYesNo(
......@@ -305,7 +305,7 @@ void LogViewer::slotClearContactHistory()
Tp::AccountPtr account = index.data(EntityModel::AccountRole).value<Tp::AccountPtr>();
Tpl::EntityPtr entity = index.data(EntityModel::EntityRole).value<Tpl::EntityPtr>();
if (account.isNull() || entity.isNull()) {
return;
return;
}
QString name = index.data(Qt::DisplayRole).toString();
......@@ -324,10 +324,10 @@ void LogViewer::slotClearContactHistory()
void LogViewer::onLogClearingFinished(Tpl::PendingOperation *operation)
{
if (!operation->errorName().isEmpty() || !operation->errorMessage().isEmpty()) {
/* Make sure we display at least some message */
QString msg = (operation->errorMessage().isEmpty()) ? operation->errorName() : operation->errorMessage();
KMessageBox::sorry(this, msg, operation->errorName(), 0);
return;
/* Make sure we display at least some message */
QString msg = (operation->errorMessage().isEmpty()) ? operation->errorName() : operation->errorMessage();
KMessageBox::sorry(this, msg, operation->errorName(), 0);
return;
}
QModelIndex index = m_entityListContextMenu->property("index").value<QModelIndex>();
......@@ -354,8 +354,8 @@ void LogViewer::slotImportKopeteLogs(bool force)
bool importDone = logsConfig.readEntry(QLatin1String("InitialKopeteImportDone"), QVariant(false)).toBool();
if (!force && importDone) {
kDebug() << "Skipping initial Kopete logs import, already done.";
return;
kDebug() << "Skipping initial Kopete logs import, already done.";
return;
}
QList<Tp::AccountPtr> accounts = m_accountManager->allAccounts();
......@@ -363,16 +363,16 @@ void LogViewer::slotImportKopeteLogs(bool force)
KTp::LogsImporter importer;
Q_FOREACH (const Tp::AccountPtr &account, accounts) {
if (importer.hasKopeteLogs(account)) {
matchingAccounts << account;
}
if (importer.hasKopeteLogs(account)) {
matchingAccounts << account;
}
}
kDebug() << "Initial Kopete logs import: found" << matchingAccounts.count() << "accounts to import";
if (!matchingAccounts.isEmpty()) {
LogsImportDialog *dialog = new LogsImportDialog(this);
dialog->importLogs(matchingAccounts);
LogsImportDialog *dialog = new LogsImportDialog(this);
dialog->importLogs(matchingAccounts);
}
logsConfig.writeEntry(QLatin1String("InitialKopeteImportDone"), true);
......@@ -381,7 +381,7 @@ void LogViewer::slotImportKopeteLogs(bool force)
void LogViewer::slotJumpToNextConversation()
{
if (!m_nextConversationDate.isValid()) {
return;
return;
}
ui->datePicker->setDate(m_nextConversationDate);
......@@ -390,7 +390,7 @@ void LogViewer::slotJumpToNextConversation()
void LogViewer::slotJumpToPrevConversation()
{
if (!m_prevConversationDate.isValid()) {
return;
return;
}
ui->datePicker->setDate(m_prevConversationDate);
......
......@@ -41,8 +41,8 @@ class LogViewer : public KXmlGuiWindow
public:
explicit LogViewer(const Tp::AccountFactoryPtr &accountFactory, const Tp::ConnectionFactoryPtr &connectionFactory,
const Tp::ChannelFactoryPtr &channelFactory, const Tp::ContactFactoryPtr &contactFactory,
QWidget *parent = 0);
const Tp::ChannelFactoryPtr &channelFactory, const Tp::ContactFactoryPtr &contactFactory,
QWidget *parent = 0);
~LogViewer();
private Q_SLOTS:
void onAccountManagerReady();
......
......@@ -46,7 +46,7 @@ LogsImportDialog::LogsImportDialog(QObject *parent)
QLabel *label = new QLabel(mainWidget);
label->setText(i18n("We have found Kopete logs that seem to match some of your KDE Telepathy accounts.\n\n"
"Do you want to import these logs from Kopete to KDE Telepathy?"));
"Do you want to import these logs from Kopete to KDE Telepathy?"));
label->setWordWrap(true);
layout->addWidget(label);
......@@ -78,13 +78,13 @@ LogsImportDialog::~LogsImportDialog()
void LogsImportDialog::importLogs(const QList< Tp::AccountPtr >& accounts)
{
Q_FOREACH(const Tp::AccountPtr &account, accounts) {
QListWidgetItem *item = new QListWidgetItem();
item->setText(account->displayName());
item->setIcon(KIcon(account->iconName()));
item->setCheckState(Qt::Checked);
item->setData(Qt::UserRole + 1, QVariant::fromValue(account));
QListWidgetItem *item = new QListWidgetItem();
item->setText(account->displayName());
item->setIcon(KIcon(account->iconName()));
item->setCheckState(Qt::Checked);
item->setData(Qt::UserRole + 1, QVariant::fromValue(account));
m_accountsList->addItem(item);
m_accountsList->addItem(item);
}
exec();
......@@ -93,14 +93,14 @@ void LogsImportDialog::importLogs(const QList< Tp::AccountPtr >& accounts)
void LogsImportDialog::slotButtonClicked(int button)
{
if (button == Ok) {
m_accountsList->setEnabled(false);
m_progressBar->setVisible(true);
enableButton(Ok, false);
enableButton(Close, false);
m_row = 0;
importFinished();
return;
m_accountsList->setEnabled(false);
m_progressBar->setVisible(true);
enableButton(Ok, false);
enableButton(Close, false);
m_row = 0;
importFinished();
return;
}
KDialog::slotButtonClicked(button);
......@@ -110,24 +110,24 @@ void LogsImportDialog::importFinished()
{
if (m_row < m_accountsList->count()) {
/* If the account is not checked, skip to next one */
if (m_accountsList->item(m_row)->checkState() != Qt::Checked) {
m_row++;
importFinished();
return;
}
/* If the account is not checked, skip to next one */
if (m_accountsList->item(m_row)->checkState() != Qt::Checked) {
m_row++;
importFinished();
return;
}
if (m_row > 0) {
m_accountsList->item(m_row - 1)->setCheckState(Qt::Unchecked);
}
if (m_row > 0) {
m_accountsList->item(m_row - 1)->setCheckState(Qt::Unchecked);
}
Tp::AccountPtr account = m_accountsList->item(m_row)->data(Qt::UserRole + 1).value<Tp::AccountPtr>();
m_importer->startLogImport(account);
m_row++;
Tp::AccountPtr account = m_accountsList->item(m_row)->data(Qt::UserRole + 1).value<Tp::AccountPtr>();
m_importer->startLogImport(account);
m_row++;
} else {
m_accountsList->item(m_row - 1)->setCheckState(Qt::Unchecked);
m_progressBar->setVisible(false);
enableButton(Close, true);
setButtonText(Close, i18n("Done"));
m_accountsList->item(m_row - 1)->setCheckState(Qt::Unchecked);
m_progressBar->setVisible(false);
enableButton(Close, true);
setButtonText(Close, i18n("Done"));
}
}
......@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
QDBusConnection::sessionBus(),
Tp::Features() << Tp::Account::FeatureCore
<< Tp::Account::FeatureAvatar
<< Tp::Account::FeatureProfile);
<< Tp::Account::FeatureProfile);
Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(
QDBusConnection::sessionBus(),
......
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