示例#1
0
void TextShow::startSearch(int parag, int index)
{
    QString to_find_string = srchdialog->getText();
    if (doSearch(to_find_string, srchdialog->case_sensitive(), (!srchdialog->get_direction()), &parag, &index)){
        setSelection(parag, index, parag, index + to_find_string.length());
        setCursorPosition(parag, index + to_find_string.length());
        ensureCursorVisible();
        return;
    }
    if (!srchdialog->isVisible()){
        QApplication::beep();
        return;
    }
    QStringList btns;
    btns.append(i18n("&Yes"));
    btns.append(i18n("&No"));

    QObjectList *l = srchdialog->queryList("QPushButton");
    QObjectListIt it( *l );
    if (it.current() == 0){
        delete l;
        QApplication::beep();
        return;
    }
    QPushButton *btnOK = static_cast<QPushButton*>(it.current());
    delete l;
    QRect rc = btnOK->rect();
    rc.moveTopLeft(btnOK->mapToGlobal(rc.topLeft()));
    BalloonMsg *msg = new BalloonMsg(!srchdialog->get_direction() ?
                                     i18n("End of document reached.\nContinue from the beginning?") :
                                     i18n("Beginning of document reached.\nContinue from the end?"),
                                     rc, btns, this);
    connect(msg, SIGNAL(action(int)), this, SLOT(searchAgain(int)));
    msg->show();
}
示例#2
0
void FileTransferDlgNotify::createFile(const QString &name, unsigned size)
{
	m_name = name;
	m_size = size;
	m_name = m_name.replace(QRegExp("\\\\"), "/");
	int n = m_name.findRev("/");
	if (n > 0)
		m_name = m_name.mid(n + 1);
	m_dlg->m_msg->addFile(m_name, size);
	FileTransfer *ft = m_dlg->m_msg->m_transfer;
	QString shortName = m_name;
	m_name = ft->dir() + m_name;
	if (ft->m_file)
		delete ft->m_file;
	m_dlg->process();
	ft->m_file = new QFile(m_name);
	if (ft->m_file->exists()){
		switch (ft->overwrite()){
		case Skip:
			skip();
			return;
		case Replace:
			if (ft->m_file->open(IO_WriteOnly | IO_Truncate)){
				ft->startReceive(0);
				return;
			}
			break;
		case Resume:
			if (ft->m_file->open(IO_WriteOnly)){
				resume();
				return;
			}
			break;
		default:
			if (ft->m_file->open(IO_WriteOnly)){
				QStringList buttons;
				buttons.append(i18n("&Replace"));
				buttons.append(i18n("&Skip"));
				if (ft->m_file->size() < size)
					buttons.append(i18n("Resu&me"));
				BalloonMsg *ask = new BalloonMsg(NULL, 
					i18n("File %1 exists") .arg(shortName), buttons, m_dlg->lblState);
				QObject::connect(ask, SIGNAL(action(int, void*)), m_dlg, SLOT(action(int, void*)));
				raiseWindow(m_dlg);
				ask->show();
				return;
			}
		}
	}else{
		if (ft->m_file->open(IO_WriteOnly)){
			ft->startReceive(0);
			return;
		}
	}
	QString errMsg = i18n("Can't create: %1") .arg(m_name);
	m_dlg->m_msg->setError(errMsg.utf8());
	ft->setError();
}
示例#3
0
void BalloonMsg::message(const QString &text, QWidget *parent, bool bModal, unsigned width, const QRect *rc)
{
    QStringList btns;
    btns.append(i18n("&Ok"));
    BalloonMsg *msg = new BalloonMsg(NULL, QString("<center>") + quoteString(text) + "</center>", btns, parent, rc, bModal, true, width);
    if (bModal){
        msg->exec();
    }else{
        msg->show();
    }
}
示例#4
0
void BalloonMsg::message(const QString &text, QWidget *parent, bool bModal)
{
    QStringList btns;
    btns.append(i18n("&Ok"));
    BalloonMsg *msg = new BalloonMsg(NULL, text, btns, parent, NULL, bModal);
    if (bModal){
        msg->exec();
    }else{
        msg->show();
    }
}
示例#5
0
void BalloonMsg::message(const QString &text, QWidget *parent, bool bModal)
{
    QPoint p = parent->mapToGlobal(parent->rect().topLeft());
    QRect rc(p.x(), p.y(), parent->width(), parent->height());
    QStringList btns;
    btns.append(i18n("&Ok"));
    BalloonMsg *msg = new BalloonMsg(text, rc, btns, parent, bModal);
    if (bModal){
        msg->exec();
    }else{
        msg->show();
    }
}
示例#6
0
void BalloonMsg::ask(void *param, const QString &text, QWidget *parent, const char *slotYes, const char *slotNo, const QRect *rc, QObject *receiver)
{
    QStringList btns;
    btns.append(i18n("&Yes"));
    btns.append(i18n("&No"));
    BalloonMsg *msg = new BalloonMsg(param, text, btns, parent, rc, false);
	if (receiver == NULL)
		receiver = parent;
    if (slotYes)
        connect(msg, SIGNAL(yes_action(void*)), receiver, slotYes);
    if (slotNo)
        connect(msg, SIGNAL(no_action(void*)), receiver, slotNo);
    msg->show();
}
示例#7
0
void BalloonMsg::ask(void *param, const QString &text, QWidget *parent,
                     const char *slotYes, const char *slotNo,
                     const QRect *rc, QObject *receiver,
                     const QString &checkText, bool *bCheck)
{
    QStringList btns;
    btns.append(i18n("&Yes"));
    btns.append(i18n("&No"));
    BalloonMsg *msg = new BalloonMsg(param, QString("<center>") + quoteString(text) + "</center>", btns, parent, rc, false, true, 300, checkText, bCheck);
    if (receiver == NULL)
        receiver = parent;
    if (slotYes)
        connect(msg, SIGNAL(yes_action(void*)), receiver, slotYes);
    if (slotNo)
        connect(msg, SIGNAL(no_action(void*)), receiver, slotNo);
    msg->show();
}
示例#8
0
void LoginDialog::deleteUin()
{
    unsigned long uin = cmbUIN->lineEdit()->text().toULong();
    if (uin == 0) return;
    pClient->load(uin);
    string s = ICQClient::cryptPassword(edtPasswd->text().local8Bit());
    if (strcmp(s.c_str(), pClient->EncryptedPassword.c_str())){
        BalloonMsg::message(i18n("Invalid password"), btnDelete);
        return;
    }
    QStringList btns;
    btns.append(i18n("&Yes"));
    btns.append(i18n("&No"));
    BalloonMsg *msg = new BalloonMsg(i18n("Delete history and incoming files for %u?") .arg(uin),
                                     btns, btnDelete);
    connect(msg, SIGNAL(action(int)), this, SLOT(realDeleteUin(int)));
    msg->show();
}
示例#9
0
void *UpdatePlugin::processEvent(Event *e)
{
    if (e->type() == EventFetchDone){
        fetchData *data = (fetchData*)(e->param());
        if (data->req_id != m_fetch_id)
            return NULL;
        string h = getHeader("Location", data->headers);
        if (h.empty()){
            time_t now;
            time(&now);
            setTime(now);
            Event e(EventSaveState);
            e.process();
        }else{
            QWidget *main = getMainWindow();
            if (main == NULL)
                return NULL;
            Command cmd;
            cmd->id		= CmdStatusBar;
            Event eWidget(EventCommandWidget, cmd);
            QWidget *statusWidget = (QWidget*)(eWidget.process());
            if (statusWidget == NULL)
                return NULL;
            m_url = h;
            QStringList l;
            l.append(i18n("Show details"));
            l.append(i18n("Remind later"));
            raiseWindow(main);
            BalloonMsg *msg = new BalloonMsg(NULL, i18n("New version SIM is released"), l, statusWidget);
            connect(msg, SIGNAL(action(int, void*)), this, SLOT(showDetails(int, void*)));
            connect(msg, SIGNAL(destroyed()), this, SLOT(msgDestroyed()));
            msg->show();
            return NULL;
        }
        m_fetch_id = 0;
    }