Пример #1
0
void wavrMessageLog::abortPendingFileOperations(void) {
    QMap<QString, wavrXmlMessage>::iterator sIndex = sendFileMap.begin();
    while(sIndex != sendFileMap.end()) {
        wavrXmlMessage fileData = sIndex.value();
        FileOp fileOp = (FileOp)wavrHelper::indexOf(FileOpNames, FO_Max, fileData.data(XML_FILEOP));
        if(fileOp == FO_Request) {
            updateFileMessage(FM_Send, FO_Abort, fileData.data(XML_FILEID));
            sIndex.value().removeData(XML_FILEOP);
            sIndex.value().addData(XML_FILEOP, FileOpNames[FO_Abort]);
        }
        sIndex++;
    }
    QMap<QString, wavrXmlMessage>::iterator rIndex = receiveFileMap.begin();
    while(rIndex != receiveFileMap.end()) {
        wavrXmlMessage fileData = rIndex.value();
        FileOp fileOp = (FileOp)wavrHelper::indexOf(FileOpNames, FO_Max, fileData.data(XML_FILEOP));
        if(fileOp == FO_Request) {
            updateFileMessage(FM_Receive, FO_Abort, fileData.data(XML_FILEID));
            rIndex.value().removeData(XML_FILEOP);
            rIndex.value().addData(XML_FILEOP, FileOpNames[FO_Abort]);
        }
        rIndex++;
    }
}
Пример #2
0
void lmcMessageLog::log_linkClicked(QUrl url) {
	QString linkPath = url.toString();

	//	this is a hack so qdesktopservices can open a network path
	if(linkPath.startsWith("file")) {
		// strip out the 'file:' prefix and get the path
		linkPath = linkPath.mid(5);
		// use a url that contains native separators
		QDesktopServices::openUrl(QUrl(QDir::toNativeSeparators(linkPath)));
		return;
	} else if(linkPath.startsWith("www")) {
		// prepend 'http://' to link
		linkPath.prepend("http://");
		QDesktopServices::openUrl(QUrl(linkPath));
		return;
	} else if(!linkPath.startsWith("lmc")) {
		QDesktopServices::openUrl(url);
		return;
	}

	QStringList linkData = linkPath.split("/", QString::SkipEmptyParts);
	FileMode mode;
	FileOp op;

	if(linkData[1].compare("fileaccept", Qt::CaseInsensitive) == 0) {
		mode = FM_Receive;
		op = FO_Accept;
	} else if(linkData[1].compare("filedecline", Qt::CaseInsensitive) == 0) {
		mode = FM_Receive;
		op = FO_Decline;
	} else if(linkData[1].compare("filecancel", Qt::CaseInsensitive) == 0) {
		mode = FM_Send;
		op = FO_Cancel;
	} else	// unknown link command
		return;

	//	Remove the link and show a confirmation message.
	updateFileMessage(mode, op, linkData[2]);

	fileOperation(linkData[2], linkData[1]);
}