Ticket #50008: patch-accept-docs-from-finder.diff
File patch-accept-docs-from-finder.diff, 5.5 KB (added by RJVB (René Bertin), 9 years ago) |
---|
-
kate/data/MacOSXBundleInfo.plist.in
From: Christoph Cullmann <cullmann@kde.org> Date: Sat, 02 Jan 2016 18:51:33 +0000 Subject: handle mac like file open for kate, thanks to René J.V. Bertin for the hint with the plist file X-Git-Url: http://quickgit.kde.org/?p=kate.git&a=commitdiff&h=cd6ec201725cf627a336015d472c39f5ff73b2a7 --- handle mac like file open for kate, thanks to René J.V. Bertin for the hint with the plist file --- diff --git kate/data/MacOSXBundleInfo.plist.in kate/data/MacOSXBundleInfo.plist.in
6 6 <string>NSApplication</string> 7 7 <key>NSHighResolutionCapable</key> 8 8 <string>True</string> 9 <key>CFBundleDevelopmentRegion</key> 10 <string>English</string> 11 <key>CFBundleExecutable</key> 12 <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> 13 <key>CFBundleGetInfoString</key> 14 <string>${MACOSX_BUNDLE_INFO_STRING}</string> 15 <key>CFBundleIconFile</key> 16 <string>${MACOSX_BUNDLE_ICON_FILE}</string> 17 <key>CFBundleIdentifier</key> 18 <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string> 19 <key>CFBundleInfoDictionaryVersion</key> 20 <string>6.0</string> 21 <key>CFBundleLongVersionString</key> 22 <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string> 23 <key>CFBundleName</key> 24 <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string> 25 <key>CFBundlePackageType</key> 26 <string>APPL</string> 27 <key>CFBundleShortVersionString</key> 28 <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string> 29 <key>CFBundleSignature</key> 30 <string>????</string> 31 <key>CFBundleVersion</key> 32 <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string> 33 <key>CSResourcesFileMapped</key> 34 <true/> 35 <key>LSRequiresCarbon</key> 36 <true/> 37 <key>NSHumanReadableCopyright</key> 38 <string>${MACOSX_BUNDLE_COPYRIGHT}</string> 9 <key>CFBundleDevelopmentRegion</key> 10 <string>English</string> 11 <key>CFBundleExecutable</key> 12 <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> 13 <key>CFBundleGetInfoString</key> 14 <string>${MACOSX_BUNDLE_INFO_STRING}</string> 15 <key>CFBundleIconFile</key> 16 <string>${MACOSX_BUNDLE_ICON_FILE}</string> 17 <key>CFBundleIdentifier</key> 18 <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string> 19 <key>CFBundleInfoDictionaryVersion</key> 20 <string>6.0</string> 21 <key>CFBundleLongVersionString</key> 22 <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string> 23 <key>CFBundleName</key> 24 <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string> 25 <key>CFBundlePackageType</key> 26 <string>APPL</string> 27 <key>CFBundleShortVersionString</key> 28 <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string> 29 <key>CFBundleSignature</key> 30 <string>????</string> 31 <key>CFBundleVersion</key> 32 <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string> 33 <key>CSResourcesFileMapped</key> 34 <true/> 35 <key>LSRequiresCarbon</key> 36 <true/> 37 <key>NSHumanReadableCopyright</key> 38 <string>${MACOSX_BUNDLE_COPYRIGHT}</string> 39 <key>LSMultipleInstancesProhibited</key> 40 <true/> 41 <key>CFBundleDocumentTypes</key> 42 <array> 43 <dict> 44 <key>CFBundleTypeExtensions</key> 45 <array> 46 <string>*</string> 47 </array> 48 <key>CFBundleTypeName</key> 49 <string>NSStringPboardType</string> 50 <key>CFBundleTypeRole</key> 51 <string>Editor</string> 52 </dict> 53 </array> 39 54 </dict> 40 55 </plist> 41 56 -
kate/kateapp.h
diff --git kate/kateapp.h kate/kateapp.h
310 310 shutdownKate(activeKateMainWindow()); 311 311 return true; 312 312 } 313 314 protected: 315 /** 316 * Event filter for QApplication to handle mac os like file open 317 */ 318 bool eventFilter(QObject *obj, QEvent *event); 313 319 314 320 private: 315 321 /** -
kateapp.cpp
diff --git kate/orig.kateapp.cpp kate/kateapp.cpp
old new 34 34 #include <QFileInfo> 35 35 #include <QTextCodec> 36 36 #include <QApplication> 37 #include <QFileOpenEvent> 37 38 38 39 #include "../../urlinfo.h" 39 40 … … 60 61 connect(&m_docManager, &KateDocManager::documentDeleted, &m_wrapper, &KTextEditor::Application::documentDeleted); 61 62 connect(&m_docManager, &KateDocManager::aboutToCreateDocuments, &m_wrapper, &KTextEditor::Application::aboutToCreateDocuments); 62 63 connect(&m_docManager, &KateDocManager::documentsCreated, &m_wrapper, &KTextEditor::Application::documentsCreated); 64 65 /** 66 * handle mac os x like file open request via event filter 67 */ 68 qApp->installEventFilter(this); 63 69 } 64 70 65 71 KateApp::~KateApp() … … 386 392 return m_pluginManager.plugin(name); 387 393 } 388 394 395 bool KateApp::eventFilter(QObject *obj, QEvent *event) 396 { 397 /** 398 * handle mac os like file open 399 */ 400 if (event->type() == QEvent::FileOpen) { 401 /** 402 * try to open and activate the new document, like we would do for stuff 403 * opened via dbus 404 */ 405 QFileOpenEvent *foe = static_cast<QFileOpenEvent*>(event); 406 KTextEditor::Document *doc = openDocUrl(foe->url(), QString(), false); 407 if (doc && activeKateMainWindow()) { 408 activeKateMainWindow()->viewManager()->activateView(doc); 409 } 410 return true; 411 } 412 413 /** 414 * else: pass over to default implementation 415 */ 416 return QObject::eventFilter(obj, event); 417 }