MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / applicationStateChanged

Method applicationStateChanged

src/gui/main_window.cpp:158–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157
158void MainWindow::applicationStateChanged()
159{
160#ifdef Q_OS_ANDROID
161 // The Android app may be started or resumed when the user triggers a suitable "intent".
162 if (QGuiApplication::applicationState() == Qt::ApplicationActive)
163 {
164 auto activity = QtAndroid::androidActivity();
165 auto intent_path = activity.callObjectMethod<jstring>("takeIntentPath").toString();
166 if (!intent_path.isEmpty())
167 {
168 const auto local_file = QUrl(intent_path).toLocalFile();
169 if (!hasOpenedFile())
170 {
171 openPathLater(local_file);
172 }
173 else if (currentPath() != local_file)
174 {
175 showStatusBarMessage(tr("You must close the current file before you can open another one."));
176 }
177 return;
178 }
179 }
180#endif
181
182 // Only on startup, we may need to load the most recently used file.
183 static bool starting_up = true;
184 if (starting_up)
185 {
186 starting_up = false;
187 QSettings settings;
188 if (path_backlog.isEmpty()
189 && settings.value(QLatin1String("openMRUFile")).toBool())
190 {
191 const auto files = settings.value(QLatin1String("recentFileList")).toStringList();
192 if (!files.isEmpty())
193 openPathLater(files[0]);
194 }
195 }
196}
197
198
199

Callers 1

mainFunction · 0.80

Calls 5

QLatin1StringClass · 0.85
QUrlClass · 0.70
toStringMethod · 0.45
isEmptyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected