diff -r f19bbd639726 -r 36d140349897 mapeditor.cpp --- a/mapeditor.cpp Thu Jun 21 14:27:46 2007 +0000 +++ b/mapeditor.cpp Mon Jun 25 12:54:19 2007 +0000 @@ -319,8 +319,11 @@ void MapEditor::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel) { + sendData(redoCom); //FIXME testing + // Main saveState + if (blockSaveState) return; if (debug) cout << "ME::saveState() for "<setFilters (filters); + fd->setCaption(vymName+" - " +tr("Set URL to a local file")); + fd->setDirectory (lastFileDir); + if (! bo->getVymLink().isEmpty() ) + fd->selectFile( bo->getURL() ); + fd->show(); + + if ( fd->exec() == QDialog::Accepted ) + { + lastFileDir=QDir (fd->directory().path()); + setURL (fd->selectedFile() ); + } + } +} + QString MapEditor::getURL() { BranchObj *bo=xelection.getBranch(); @@ -4043,18 +4083,7 @@ void MapEditor::testFunction1() { - - tcpServer = new QTcpServer(this); - if (!tcpServer->listen(QHostAddress::Any,54321)) { - QMessageBox::critical(this, tr("Fortune Server"), - tr("Unable to start the server: %1.") - .arg(tcpServer->errorString())); - close(); - return; - } - connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient())); - if (debug) - cout<<"Server is running on port "<serverPort()<seek(0); - out << (quint16)(block.size() - sizeof(quint16)); - - for (int i=0; ipeerAddress().toString().ascii()<write (block); - } + sendData("Foo"); } void MapEditor::contextMenuEvent ( QContextMenuEvent * e ) @@ -4756,15 +4773,24 @@ mapCenter->reposition(); } -void MapEditor::autosave() + +void MapEditor::sendSelection() { - // Disable autosave, while we have gone back in history - int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail")); - if (redosAvail>0) return; - - - if (mapUnsaved &&mapChanged && settings.value ("/mapeditor/autosave/use",true).toBool() ) - mainWindow->fileSave (this); + sendData (xelection.getSelectString() ); +} + +void MapEditor::newServer() +{ + tcpServer = new QTcpServer(this); + if (!tcpServer->listen(QHostAddress::Any,54321)) { + QMessageBox::critical(this, "vym server", + QString("Unable to start the server: %1.").arg(tcpServer->errorString())); + close(); + return; + } + connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient())); + if (debug) + cout<<"Server is running on port "<serverPort()<disconnectFromHost(); } + +void MapEditor::sendData(const QString &s) +{ + // Create bytearray to send + QByteArray block; + QDataStream out(&block, QIODevice::WriteOnly); + out.setVersion(QDataStream::Qt_4_0); + + // Reserve some space for blocksize + out << (quint16)0; + + // Write data + out << s; + + // Go back and write blocksize so far + out.device()->seek(0); + out << (quint16)(block.size() - sizeof(quint16)); + + for (int i=0; ipeerAddress().toString().ascii()<write (block); + } +} +void MapEditor::autosave() +{ + // Disable autosave, while we have gone back in history + int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail")); + if (redosAvail>0) return; + + + if (mapUnsaved &&mapChanged && settings.value ("/mapeditor/autosave/use",true).toBool() ) + mainWindow->fileSave (this); +} + + /*TODO not needed? void MapEditor::contentsDropEvent(QDropEvent *event) {