And why Mac can not read argument on main?
only linux & win open the file on list arguments
int main(int argc, char *argv[]) {
Gui_Main::self()->setWindowTitle( _PROGRAM_TITLE_ );
Gui_Main::self()->show();
Gui_Main::self()->Incomming(a.arguments());
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
};
{
if (files.size() > 0) {
for (int i = 0; i < files.size(); ++i) {
qDebug() << "### unfilone " << unfilone;
if (is_file(unfilone)) {
if (unfilone.endsWith(".fo")) {
OpenOtherResult(unfilone);
} else if (unfilone.endsWith(".xml")) {
LoadXmlFile(unfilone);
} else if (unfilone.endsWith(".xsl")) {
LoadXsltFile(unfilone);
}
}
}
}
}
int main(int argc, char *argv[]) {
QApplication a( argc, argv );
QCoreApplication::setOrganizationName(_ORGANIZATION_NAME_);
QCoreApplication::setOrganizationDomain(_PROGRAM_NAME_DOMAINE_);
QCoreApplication::setApplicationName(_PROGRAM_NAME_);
Gui_Main::self()->setWindowTitle( _PROGRAM_TITLE_ );
Gui_Main::self()->show();
Gui_Main::self()->Incomming(a.arguments());
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
};
void Gui_Main::Incomming( QStringList files )
{
if (files.size() > 0) {
for (int i = 0; i < files.size(); ++i) {
QString unfilone = files.at(i);
qDebug() << "### unfilone " << unfilone;
if (is_file(unfilone)) {
if (unfilone.endsWith(".fo")) {
OpenOtherResult(unfilone);
} else if (unfilone.endsWith(".xml")) {
LoadXmlFile(unfilone);
} else if (unfilone.endsWith(".xsl")) {
LoadXsltFile(unfilone);
}
}
}
}
}
To copy to clipboard, switch view to plain text mode
And dropEvent in event (url file ) is accepted from Mac Window....
linux open if is not KDE also work on gnome or the fast xfce4 X
void Gui_Main
::Grabdata(const QMimeData *data
) {
if (!data) {
return;
}
QList<QUrl> urlelist;
if (data->hasUrls()) {
urlelist = data->urls();
for ( int i = 0; i < urlelist.size(); ++i ) {
////////QUrl oneurl = urlelist.at(i);
QString unfilone
= urlelist.
at(i
).
toLocalFile();
qDebug() << "### url " << unfilone;
if (is_file(unfilone)) {
if (unfilone.endsWith(".fo")) {
OpenOtherResult(unfilone);
} else if (unfilone.endsWith(".xml")) {
LoadXmlFile(unfilone);
} else if (unfilone.endsWith(".xsl")) {
LoadXsltFile(unfilone);
}
}
}
}
}
void Gui_Main::Grabdata(const QMimeData *data)
{
if (!data) {
return;
}
QList<QUrl> urlelist;
if (data->hasUrls()) {
urlelist = data->urls();
for ( int i = 0; i < urlelist.size(); ++i ) {
////////QUrl oneurl = urlelist.at(i);
QString unfilone = urlelist.at(i).toLocalFile();
qDebug() << "### url " << unfilone;
if (is_file(unfilone)) {
if (unfilone.endsWith(".fo")) {
OpenOtherResult(unfilone);
} else if (unfilone.endsWith(".xml")) {
LoadXmlFile(unfilone);
} else if (unfilone.endsWith(".xsl")) {
LoadXsltFile(unfilone);
}
}
}
}
}
To copy to clipboard, switch view to plain text mode
I like to fix this on mac .... is so easy drag url to task....
the code can found on svn the last commit http://sourceforge.net/projects/visual-xsltproc/
Bookmarks