Skip to content

Commit c3e5da2

Browse files
author
Koen Deforche
committed
some last doc/misc fixes for 3.3.3
1 parent 599e917 commit c3e5da2

File tree

13 files changed

+125
-78
lines changed

13 files changed

+125
-78
lines changed

src/Wt/WAbstractItemView

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ public:
491491
*
492492
* The default column width is 150 pixels.
493493
*
494+
* \note The height must be specified in WLength::Pixel units.
495+
*
494496
* \note The actual space occupied by each column is the column width
495497
* augmented by 7 pixels for internal padding and a border.
496498
*/

src/Wt/WAbstractItemView.C

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,21 @@ bool WAbstractItemView::internalSelect(const WModelIndex& index,
809809

810810
if (option == ToggleSelect)
811811
option = isSelected(index) ? Deselect : Select;
812-
else if (option == ClearAndSelect) {
812+
813+
if (selectionMode() == SingleSelection && option == Select)
814+
option = ClearAndSelect;
815+
816+
if ((option == ClearAndSelect || option == Select) &&
817+
selectionModel()->selection_.size() == 1 &&
818+
isSelected(index))
819+
return false;
820+
else if (option == Deselect && !isSelected(index))
821+
return false;
822+
823+
if (option == ClearAndSelect) {
813824
clearSelection();
814825
option = Select;
815-
} else if (selectionMode() == SingleSelection && option == Select)
816-
clearSelection();
826+
}
817827

818828
/*
819829
* now option is either Select or Deselect and we only need to do
@@ -822,8 +832,7 @@ bool WAbstractItemView::internalSelect(const WModelIndex& index,
822832
if (option == Select)
823833
selectionModel()->selection_.insert(index);
824834
else
825-
if (!selectionModel()->selection_.erase(index))
826-
return false;
835+
selectionModel()->selection_.erase(index);
827836

828837
return true;
829838
}
@@ -913,9 +922,10 @@ void WAbstractItemView::selectionHandleClick(const WModelIndex& index,
913922
}
914923
} else {
915924
if ((modifiers & (ControlModifier | MetaModifier)) &&
916-
isSelected(index))
925+
isSelected(index)) {
917926
clearSelection();
918-
else
927+
selectionChanged_.emit();
928+
} else
919929
select(index, Select);
920930
}
921931
}

src/Wt/WApplication

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public:
165165
*
166166
* Throughout the session, the instance is available through
167167
* WApplication::instance() (or through #wApp). The application may be
168-
* quited either using the method quit(), or because of a timeout
168+
* exited either using the method quit(), or because of a timeout
169169
* after the user has closed the window, but not because the user does
170170
* not interact: keep-alive messages in the background will keep the
171171
* session around as long as the user has the page opened. In either
@@ -177,7 +177,7 @@ public:
177177
* Throughout the session, the instance is available through the
178178
* static method WApplication::instance(), which uses thread-specific
179179
* storage to keep track of the current session. The application may
180-
* be quited either using the method quit(), or because of a timeout
180+
* be exited either using the method quit(), or because of a timeout
181181
* after the user has closed the window, but not because the user does
182182
* not interact: keep-alive messages in the background will keep the
183183
* session around as long as the user has the page opened.
@@ -1762,6 +1762,15 @@ public:
17621762
*/
17631763
std::string docType() const;
17641764

1765+
/*! \brief Quits the application.
1766+
*
1767+
* This quits the application with a default restart message resolved
1768+
* as WString::tr("Wt.QuittedMessage").
1769+
*
1770+
* \sa quit(const WString&)
1771+
*/
1772+
void quit();
1773+
17651774
/*! \brief Quits the application.
17661775
*
17671776
* The method returns immediately, but has as effect that the
@@ -1772,28 +1781,27 @@ public:
17721781
* pending and applied during the current event handling) will still
17731782
* be rendered, after which the application is terminated.
17741783
*
1775-
* You might want to make sure no more events can be received from
1776-
* the user, by not having anything clickable, for example by
1777-
* displaying only text. Even better is to redirect() the user to
1778-
* another, static, page in conjunction with %quit().
1784+
* If the restart message is not empty, then the user will be
1785+
* offered to restart the application (using the provided message)
1786+
* when further interacting with the application.
17791787
*
17801788
* \sa redirect()
17811789
*/
1782-
void quit();
1790+
void quit(const WString& restartMessage);
17831791

17841792
/*! \brief Returns whether the application has quit. (<b>deprecated</b>)
17851793
*
17861794
* \sa quit()
17871795
*
17881796
* \deprecated hasQuit() is proper English
17891797
*/
1790-
bool isQuited() const { return quited_; }
1798+
bool isQuited() const { return quitted_; }
17911799

17921800
/*! \brief Returns whether the application has quit.
17931801
*
17941802
* \sa quit()
17951803
*/
1796-
bool hasQuit() const { return quited_; }
1804+
bool hasQuit() const { return quitted_; }
17971805

17981806
/*! \brief Returns the current maximum size of a request to the
17991807
* application.
@@ -1921,6 +1929,8 @@ public:
19211929
*/
19221930
void setConfirmCloseMessage(const WString& message);
19231931

1932+
/*! \brief Sets the message for the user when the application was .
1933+
*/
19241934
void enableInternalPaths();
19251935

19261936
// should we move this into an InternalPaths utility class / namespace ?
@@ -2180,7 +2190,8 @@ private:
21802190
#endif // WT_TARGET_JAVA
21812191
std::string javaScriptClass_;
21822192
AjaxMethod ajaxMethod_;
2183-
bool quited_;
2193+
bool quitted_;
2194+
WString quittedMessage_;
21842195
std::string onePixelGifUrl_;
21852196
bool internalPathsEnabled_;
21862197
WWidget *exposedOnly_;

src/Wt/WApplication.C

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ WApplication::WApplication(const WEnvironment& env
9898
eventSignalPool_(new boost::pool<>(sizeof(EventSignal<>))),
9999
#endif // WT_CNOR
100100
javaScriptClass_("Wt"),
101-
quited_(false),
101+
quitted_(false),
102102
internalPathsEnabled_(false),
103103
exposedOnly_(0),
104104
loadingIndicator_(0),
@@ -673,7 +673,13 @@ std::string WApplication::resolveRelativeUrl(const std::string& url) const
673673

674674
void WApplication::quit()
675675
{
676-
quited_ = true;
676+
quit(WString::tr("Wt.QuittedMessage"));
677+
}
678+
679+
void WApplication::quit(const WString& restartMessage)
680+
{
681+
quitted_ = true;
682+
quittedMessage_ = restartMessage;
677683
}
678684

679685
WWidget *WApplication::findWidget(const std::string& name)
@@ -928,7 +934,7 @@ void WApplication::refresh()
928934
if (domRoot2_) {
929935
domRoot2_->refresh();
930936
} else {
931-
widgetRoot_->refresh();
937+
domRoot_->refresh();
932938
}
933939

934940
if (title_.refresh())

src/Wt/WCompositeWidget.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ bool WCompositeWidget::isVisible() const
218218
else if (parent())
219219
return parent()->isVisible();
220220
else
221-
return true;
221+
return impl_->isRendered();
222222
}
223223

224224
void WCompositeWidget::setDisabled(bool disabled)

src/Wt/WTableView.C

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,9 @@ void WTableView::scrollTo(const WModelIndex& index, ScrollHint hint)
17981798
if (isRendered()) {
17991799
WStringStream s;
18001800

1801-
s << "setTimeout(function() { jQuery.data("
1801+
s << "jQuery.data("
1802+
<< jsRef() << ", 'obj').setScrollToPending();"
1803+
<< "setTimeout(function() { jQuery.data("
18021804
<< jsRef() << ", 'obj').scrollTo(-1, "
18031805
<< rowY << "," << (int)hint << "); }, 0);";
18041806

src/Wt/WWebWidget.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ bool WWebWidget::isVisible() const
10981098
if (parent())
10991099
return parent()->isVisible();
11001100
else
1101-
return true;
1101+
return isRendered();
11021102
}
11031103

11041104
void WWebWidget::setDisabled(bool disabled)

src/js/WTableView.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ WT_DECLARE_WT_MEMBER
3232
}
3333

3434
var scrollX1 = 0, scrollX2 = 0, scrollY1 = 0, scrollY2 = 0;
35+
var scrollToPending = false;
3536

3637
/*
3738
* We need to remember this for when going through a hide()
@@ -49,6 +50,7 @@ WT_DECLARE_WT_MEMBER
4950
return;
5051

5152
if (contentsContainer.clientWidth && contentsContainer.clientHeight
53+
&& (!scrollToPending)
5254
&& (contentsContainer.scrollTop < scrollY1
5355
|| contentsContainer.scrollTop > scrollY2
5456
|| contentsContainer.scrollLeft < scrollX1
@@ -205,13 +207,18 @@ WT_DECLARE_WT_MEMBER
205207
headerColumnsContainer.scrollTop = scrollTop;
206208
};
207209

210+
this.setScrollToPending = function() {
211+
scrollToPending = true;
212+
};
213+
208214
this.scrollToPx = function(x, y) {
209215
scrollTop = y;
210216
scrollLeft = x;
211217
this.resetScroll();
212218
};
213219

214220
this.scrollTo = function(x, y, hint) {
221+
scrollToPending = false;
215222
if (y != -1) {
216223
var top = contentsContainer.scrollTop,
217224
height = contentsContainer.clientHeight;

src/js/WTableView.min.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/WebRenderer.C

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void WebRenderer::letReloadJS(WebResponse& response, bool newSession,
216216

217217
// FIXME: we should foresee something independent of app->javaScriptClass()
218218
response.out() <<
219-
"if (window.Wt) window.Wt._p_.quit(); window.location.reload(true);";
219+
"if (window.Wt) window.Wt._p_.quit(null); window.location.reload(true);";
220220
}
221221

222222
void WebRenderer::letReloadHTML(WebResponse& response, bool newSession)
@@ -434,7 +434,7 @@ void WebRenderer::serveError(int status, WebResponse& response,
434434
<< '\n';
435435
} else {
436436
response.out() << app->javaScriptClass()
437-
<< "._p_.quit();"
437+
<< "._p_.quit(null);"
438438
<< "document.title = 'Error occurred.';"
439439
<< "document.body.innerHtml='<h2>Error occurred.</h2>' +"
440440
<< WWebWidget::jsStringLiteral(message)
@@ -887,6 +887,8 @@ void WebRenderer::serveMainscript(WebResponse& response)
887887
script.setVar("INNER_HTML", innerHtml);
888888
script.setVar("ACK_UPDATE_ID", expectedAckId_);
889889
script.setVar("SESSION_URL", WWebWidget::jsStringLiteral(sessionUrl()));
890+
script.setVar("QUITTED_STR",
891+
WString::tr("Wt.QuittedMessage").jsStringLiteral());
890892

891893
std::string deployPath = session_.env().publicDeploymentPath_;
892894
if (deployPath.empty())
@@ -1111,8 +1113,10 @@ void WebRenderer::serveMainAjax(WStringStream& out)
11111113

11121114
addResponseAckPuzzle(s);
11131115

1114-
if (app->isQuited())
1115-
s << app->javaScriptClass() << "._p_.quit();";
1116+
if (app->hasQuit())
1117+
s << app->javaScriptClass() << "._p_.quit("
1118+
<< (app->quittedMessage_.empty() ? "null" :
1119+
app->quittedMessage_.jsStringLiteral()) + ");";
11161120

11171121
if (widgetset)
11181122
app->domRoot2_->rootAsJavaScript(app, s, true);
@@ -1559,7 +1563,9 @@ void WebRenderer::collectJavaScriptUpdate(WStringStream& out)
15591563
app->streamAfterLoadJavaScript(out);
15601564

15611565
if (app->isQuited())
1562-
out << app->javaScriptClass() << "._p_.quit();";
1566+
out << app->javaScriptClass() << "._p_.quit("
1567+
<< (app->quittedMessage_.empty() ? "null" :
1568+
app->quittedMessage_.jsStringLiteral()) + ");";
15631569

15641570
if (updateLayout_) {
15651571
out << "window.onresize();";

0 commit comments

Comments
 (0)