Ejemplo n.º 1
0
bool CrateDAO::renameCrate(const int crateId, const QString& newName) {
    QSqlQuery query(m_database);
    query.prepare("UPDATE " CRATE_TABLE " SET name = :name WHERE id = :id");
    query.bindValue(":name", newName);
    query.bindValue(":id", crateId);

    if (!query.exec()) {
        LOG_FAILED_QUERY(query);
        return false;
    }
    emit(renamed(crateId));
    return true;
}
Ejemplo n.º 2
0
bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
    if (!index.isValid())
        return false;
    if (role != Qt::EditRole)
        return false;

    Node *node = nodeForIndex(index);

    Utils::FileName orgFilePath = node->filePath();
    Utils::FileName newFilePath = orgFilePath.parentDir().appendPath(value.toString());

    ProjectExplorerPlugin::renameFile(node, newFilePath.toString());
    emit renamed(orgFilePath, newFilePath);
    return true;
}
std::string JSCLanguageBase::renamed(const JSCProperty::Path& path, const std::string& lastName) const {
  size_t maxPathLength = 0;
  std::string result;

  for (const auto& rename : m_renameMap) {
    if (isSubpath(path, lastName, rename.first) && rename.first.length() > maxPathLength) {
      maxPathLength = rename.first.length();
      result = rename.second;
    }
  }

  if (maxPathLength > 0) {
    return result;
  }

  return renamed(lastName);
}
Ejemplo n.º 4
0
ContactListItem::ContactListItem(Contact* contact)
{
	m_contact = contact;
	m_group = 0;
	
	setEditable(false);
	setDragEnabled(true);
	setDropEnabled(false);

	setText(m_contact->nickname());

	if (m_contact->isPhone())
	{
		setIcon(QIcon(":icons/phone.png"));

		setDragEnabled(false);
	}
	else if (m_contact->isConference())
	{
		setIcon(QIcon(":icons/msg_conference.png"));

		setDragEnabled(false);
	}
	else
	{
//		checkVisibility();

		connect(m_contact, SIGNAL(statusChanged(OnlineStatus)), this, SLOT(update()));
		connect(m_contact, SIGNAL(groupChanged(bool)), this, SLOT(changeGroup(bool)));
		connect(m_contact, SIGNAL(visibilityChanged()), this, SLOT(update()));
		connect(m_contact, SIGNAL(ignoredChanged()), this, SLOT(update()));
	}
	QFont f = font();
	/*if (!m_contact->isIgnored())
		f.setPointSize(9);
	setFont(f);*/
	setSizeHint(QSize(sizeHint().width(), 52));

	connect(m_contact, SIGNAL(renamed(QString)), this, SLOT(update()));
	connect(m_contact, SIGNAL(destroyed(QObject*)), this, SLOT(destroyItem()));
}
void FolderTreeWidget::emitRenamed( QTreeWidgetItem *item )
{
  emit renamed( item );
}
Ejemplo n.º 6
0
ChatWindow::ChatWindow(Account* account, ChatSession* s, EmoticonSelector* emoticonSelector, MultSelector* multSelector)
	: QWidget(),
	  m_account(account), session(s), messageEditor(0), smsEditor(0), flashPlayer(0)
{
	qDebug() << Q_FUNC_INFO << "{";

	transferStatus = None;

	QVBoxLayout* layout = new QVBoxLayout;
	layout->setContentsMargins(0, 0, 0, 0);

	isNewMessage = false;

	connect(s->contact(), SIGNAL(renamed(QString)), this, SLOT(contactUpdated()));
	connect(s->contact(), SIGNAL(ignoredChanged()), this, SLOT(contactIgnored()));

	timer = new QTimer(this);
	timer->setSingleShot(true);
	connect(timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));

	QHBoxLayout* mainLayout = new QHBoxLayout;
	splitter = new QSplitter(Qt::Vertical, this);

	QWidget* chatWidget = new QWidget;
	QHBoxLayout* chatWidgetLayout = new QHBoxLayout;
	chatWidgetLayout->setContentsMargins(1, 1, 1, 1);
	chatWidgetLayout->setSpacing(1);

	QToolBar* topToolbar = new QToolBar;
	QAction* games = new QAction(QIcon(), "", this);
	games->setCheckable(true);
	connect(games, SIGNAL(triggered(bool)), this, SLOT(showGameMenu(bool)));

	topToolbar->addAction(games);

	layout->addWidget(topToolbar);

	chatView = new AnimatedTextBrowser;
	chatWidgetLayout->addWidget(chatView);
	connect(chatView, SIGNAL(anchorClicked(QUrl)), this, SLOT(slotAnchorClicked(QUrl)));
	if (!s->contact()->isPhone() && !session->contact()->isConference())
	{
		AvatarBoxWithHandle* avatarBoxWithHandle = new AvatarBoxWithHandle(m_account->avatarsPath(), session->contact()->email());

		avatarBoxWithHandle->toggle(m_account->settings()->value("ChatWindow/TopAvatarBoxState", false).toBool());

		connect(avatarBoxWithHandle, SIGNAL(toggled(bool)), SLOT(saveTopAvatarBoxState(bool)));
		chatWidgetLayout->addWidget(avatarBoxWithHandle);
	}
	chatWidget->setLayout(chatWidgetLayout);
	splitter->addWidget(chatWidget);

	if (!s->contact()->isPhone())
	{
		QWidget* bottomWidget = new QWidget;
		QHBoxLayout* bottomWidgetLayout = new QHBoxLayout;
		bottomWidgetLayout->setContentsMargins(1, 1, 1, 1);
		bottomWidgetLayout->setSpacing(1);

		editorsWidget = new QTabWidget;
		editorsWidget->setStyleSheet("QTabWidget::pane { border: 0px; } QTabWidget::tab-bar { left: 1px; } QTabBar::tab { padding: 0px 32px 0px 32px; font: bold 9px; }");
		editorsWidget->setTabPosition(QTabWidget::South);
		editorsWidget->setTabShape(QTabWidget::Triangular);

		messageEditor = new MessageEditor(m_account, session->contact(), emoticonSelector, multSelector);
		connect(messageEditor, SIGNAL(sendPressed()), this, SLOT(sendMessage()));
		connect(messageEditor, SIGNAL(textChanged()), session, SLOT(sendTyping()));
		connect(messageEditor, SIGNAL(wakeupPressed()), this, SLOT(wakeupContact()));
		connect(messageEditor, SIGNAL(showMult(const QString&)), this, SLOT(sendMult(const QString&)));
		connect(this, SIGNAL(messageEditorActivate()), messageEditor, SLOT(messageEditorActivate()));

		connect(messageEditor, SIGNAL(setIgnore(bool)), this, SIGNAL(setIgnore(bool)));
		connect(this, SIGNAL(ignoreSet(bool)), messageEditor, SLOT(slotIgnoreSet(bool)));

		connect(messageEditor, SIGNAL(setSignalCheckSpelling(bool)), this, SIGNAL(setSignalCheckSpelling(bool)));
		connect(this, SIGNAL(signalCheckSpellingSet(bool)), messageEditor, SLOT(setCheckSpelling(bool)));

		fileMessageOut = new FileMessage(FileMessage::Outgoing, this);
		fileMessageIn = new FileMessage(FileMessage::Incoming, this);
		fileMessageIn->setAccEmail(account->email());
		fileMessageIn->setContEmail(session->contact()->email());
		fileMessageOut->setAccEmail(account->email());
		fileMessageOut->setContEmail(session->contact()->email());

		connect(fileMessageOut, SIGNAL(fileTransferred(FileMessage::Status, QString, QString)), this, SLOT(slotFileTransferred(FileMessage::Status, QString, QString)));
		connect(fileMessageOut, SIGNAL(progress(FileMessage::Status, int)), messageEditor, SLOT(slotProgress(FileMessage::Status, int)));
		connect(fileMessageIn, SIGNAL(startTransferring(quint32)), this, SLOT(transferStarted(quint32)));
		connect(fileMessageIn, SIGNAL(fileTransferred(FileMessage::Status, QString, QString)), this, SLOT(slotFileTransferred(FileMessage::Status, QString, QString)));
		connect(fileMessageIn, SIGNAL(progress(FileMessage::Status, int)), messageEditor, SLOT(slotProgress(FileMessage::Status, int)));
		connect(m_account->client(), SIGNAL(fileTransferAck(quint32, QByteArray, quint32, QByteArray)), fileMessageOut, SLOT(slotFileTransferStatus(quint32, QByteArray, quint32, QByteArray)));
		connect(m_account->client(), SIGNAL(proxyAck(quint32, QByteArray, quint32, quint32, QByteArray, QByteArray, quint32, quint32, quint32, quint32)), fileMessageOut, SLOT(slotProxyAck(quint32, QByteArray, quint32, quint32, QByteArray, QByteArray, quint32, quint32, quint32, quint32)));
		connect(m_account->client(), SIGNAL(fileTransferAck(quint32, QByteArray, quint32, QByteArray)), fileMessageIn, SLOT(slotFileTransferStatus(quint32, QByteArray, quint32, QByteArray)));
		connect(m_account->client(), SIGNAL(proxy(QByteArray, quint32, quint32, QByteArray, QByteArray, quint32, quint32, quint32, quint32)), fileMessageIn, SLOT(slotProxy(QByteArray, quint32, quint32, QByteArray, QByteArray, quint32, quint32, quint32, quint32)));

		connect(messageEditor, SIGNAL(transferringCancel()), this, SLOT(transferringCancelled()));

		editorsWidget->addTab(messageEditor, tr("Text"));
		if (!session->contact()->isConference())
		{
			smsEditor = new SmsEditor(m_account, session->contact());
			connect(smsEditor, SIGNAL(sendPressed()), this, SLOT(sendSms()));

			editorsWidget->addTab(smsEditor, tr("SMS"));

			connect(editorsWidget, SIGNAL(currentChanged(int)), this, SLOT(slotEditorActivate(int)));
		}
Ejemplo n.º 7
0
void HttpEngine::handleDownloadHeaders(QHttpResponseHeader header)
{
	switch(header.statusCode())
	{
	case 200:
	{
		if(m_file.pos() && !header.hasKey("content-range"))
		{
			if(m_nSegmentStart < 0)
			{
				// resume not supported
				m_file.resize(0);
				m_file.seek(0);
				
				emit statusMessage(tr("Resume not supported"));
			}
			else
				throw tr("Segmentation not supported by server");
		}
	}
	case 206: // data will follow
	{
		bool bChunked = false;
		if(header.value("transfer-encoding").compare("chunked",Qt::CaseInsensitive) == 0)
			bChunked = true;
		else
		{
			m_nToTransfer = header.value("content-length").toLongLong();
			emit receivedSize(m_nToTransfer+m_nResume);
		}
		
		if(header.hasKey("content-disposition"))
		{
			QString disp = header.value("content-disposition");
			int pos = disp.indexOf("filename=");
			
			if(pos != -1)
			{
				QString name = disp.mid(pos+9);
				
				if(name.startsWith('"') && name.endsWith('"'))
					name = name.mid(1, name.size()-2);
				emit renamed(name);
			}
		}
		
		dataCycle(bChunked);
		emit finished(false);
		
		break;
	}
	case 301 ... 399: // redirect
		emit redirected(header.value("location"));
		break;
	case 416: // Requested Range Not Satisfiable
		m_strError = tr("Requested Range Not Satisfiable - the file has probably already been downloaded");
		emit finished(false);
		break;
	default: // error
		throw header.reasonPhrase();
	}
}